Moving createRoot/hydrateRoot to react-dom/client #125
rickhanlonii
announced in
Announcement
Replies: 2 comments 12 replies
|
If I’ve also noticed that you are using inconsistent import styles and I believe that it should be fixed - either stick to a default import or to a namespace import |
1 reply
|
@eps1lon did u have a chance to rethink the impact on the libraries that you maintain (such as RTL)? Is React team still OK with making it impossible/hard for certain libraries to depend on |
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Overview
For the next React 18 RC (RC 1) we're moving both
createRootandhydrateRoottoreact-dom/client:Using these APIs from the top level will now warn.
Motivation
There are two reasons for this change.
First, it allows components to use the isomorphic APIs such as
flushSyncwithout pulling in the client-specific entry. This means that if you server render a component that only usesflushSyncon the client, the server doesn't need to pull in the client-specific code forcreateRootorhydrateRoot.Second, it creates parity with
react-dom/server:Before:
After:
Warnings
When you first upgrade to RC 1 from previous React 18 pre-release versions, you'll see a warning when using the top level functions.
For
createRoot:For
hydrateRoot:For more information see react/react#23385
All reactions