You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.4 KiB
1.4 KiB
title |
---|
ReactDOMClient APIs |
The ReactDOMClient APIs let you render React components in the browser.
Typically, you will use ReactDOM at the top level of your app to display your components. You will either use it directly or a framework may do it for you. Most of your components should not need to import this module.
Installation {/installation/}
npm install react-dom
// Importing a specific API:
import { createRoot } from 'react-dom/client';
// Importing all APIs together:
import * as ReactDOMClient from 'react-dom/client';
You'll also need to install the same version of React.
Browser Support {/browser-support/}
ReactDOM supports all popular browsers, including Internet Explorer 9 and above. Some polyfills are required for older browsers such as IE 9 and IE 10.
Exports {/exports/}
Create and render a React root.
const root = createRoot(domNode);
root.render(<App />);
Hydrate server-rendered HTML.
hydrateRoot(domNode, <App />);