-
-
Notifications
You must be signed in to change notification settings - Fork 638
Description
-
Currently,
unmount
inclientStartup.ts
doesReactDOM.unmountComponentAtNode(domNode); With the new Root API, it should be replaced by
root.unmount()
, which means we need to store rendered roots. The current approach will not work due to https://github.com/facebook/react/blob/2e0d86d22192ff0b13b71b4ad68fea46bf523ef6/packages/react-dom/src/client/ReactDOMLegacy.js#L391-L401:if (__DEV__) { const isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; if (isModernRoot) { console.error( 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?', ); } }
We should add tests which cover this. (Fix unmounting in React 18 #1466)
-
Clarify situation with multiple roots and if we should use
createPortal
instead. See the discussion starting with React 18 conditional support #1449 (comment). Also noteidentifierPrefix
: optional prefix React uses for ids generated by React.useId. Useful to avoid conflicts when using multiple roots on the same page. Must be the same prefix used on the server.in https://reactjs.org/docs/react-dom-client.html#createroot (the same option is available for
hydrateRoot
). -
Update places in docs which still use
ReactDOM.render
. -
Look if we want any changes based on React Router v6.