add custom element section

This commit is contained in:
Josh Story
2024-04-25 09:43:17 -07:00
parent a6dd56a462
commit 3570e72b93

View File

@@ -673,7 +673,15 @@ For more info and examples, see the docs for [`createRoot`](/reference/react-dom
### Custom Element Support {/*support-for-web-components*/}
TODO
Custom Elements have been part of the web platform for a long while now however using them with React has been impractical because React has always treated unrecognized props as attributes rather than properties.
React 19 adds support for custom elements and passes all tests on [Custom Elements Everywhere](https://custom-elements-everywhere.com/)
During Server Side Rendering props passed to a custom element will render as attributes if their type is a `"string"`, `"number"`, or the value is `true`. props with type `"object"`, `"symbol"`, `"function"`, or value `false` will be omitted.
During Client Side Rendering props that match a property on the Custom Element instance will be assigned as properties, otherwise they will be assigned as attributes.
Thanks [Joey Arhar](https://github.com/josepharhar) for driving the design and implementation of Custom Element support in React.
#### How to Upgrade {/*how-to-upgrade*/}