File tree Expand file tree Collapse file tree
src/routes/reference/jsx-attributes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 - dom
99version : " 1.0"
1010description : >-
11- Set an element's `textContent` property from JSX.
11+ Set an element's `textContent` property from JSX with plain text content .
1212---
1313
14- ` textContent ` sets an element's ` textContent ` property.
14+ ` textContent ` sets an element's ` textContent ` property with plain text content .
1515
1616## Syntax
1717
@@ -23,19 +23,19 @@ description: >-
2323
2424- ** Type:** ` string | number `
2525
26- Text written to the element.
26+ Text written to the element without parsing markup .
2727
2828## Behavior
2929
30- - Setting ` textContent ` replaces the element's existing children with a single text node .
31- - The value is written through the DOM ` textContent ` property.
30+ - ` textContent ` replaces the element's existing child content instead of merging with JSX children .
31+ - On the client, the value is written through the DOM ` textContent ` property. During SSR, it is emitted as escaped text instead of raw HTML .
3232
3333## Examples
3434
3535### Basic usage
3636
3737``` tsx
38- <div textContent = { count () } />
38+ <div textContent = { " <strong>Hello</strong> " } />
3939```
4040
4141## Related
You can’t perform that action at this time.
0 commit comments