JSX attributes

innerHTML

Edit this page

innerHTML sets an element's innerHTML property.


Syntax

<div innerHTML={html} />

Value

  • Type: string

HTML string inserted as raw markup into the element.


Behavior

  • Setting innerHTML replaces the element's existing children with nodes parsed from the string.
  • The value is written through the DOM innerHTML property.
  • In SSR output, the HTML string is emitted as child content without escaping.
  • Unlike textContent, innerHTML parses markup instead of inserting plain text.
caution

Using innerHTML with unsanitized user-supplied data can introduce security vulnerabilities.


Examples

Basic usage

<div innerHTML={"<strong>Hello</strong>"} />

Report an issue with this page