The react-dom package contains methods that are only supported for the web applications (which run in the browser DOM environment). They are not supported for React Native.


React DOM APIs

These APIs can be imported from your components. They are rarely used:

  • createPortal lets you render child components in a different part of the DOM tree.
  • flushSync lets you force React to flush a state update and update the DOM synchronously.

React DOM entry points

The react-dom package provides two additional entry points:

  • react-dom/client contains APIs to render React components on the client (in the browser).
  • react-dom/server contains APIs to render React components on the server.

Deprecated React DOM APIs

Deprecated

This API will be removed in a future major version of React.