-
Notifications
You must be signed in to change notification settings - Fork 45.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReactDOM.createRoot creates an async root #11769
Conversation
Makes createRoot the opt-in API for async updates. Now we don't have to check the top-level element to see if it's an async container.
90573d7
to
e540893
Compare
@bvaughn React Native doesn't have |
e540893
to
67a12fd
Compare
Unclear. We could hook into something like For the time being, we can continue to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw this looks fine to me.
@@ -1300,7 +1301,7 @@ if (enableCreateRoot) { | |||
options?: RootOptions, | |||
): ReactRoot { | |||
const hydrate = options != null && options.hydrate === true; | |||
return new ReactRoot(container, hydrate); | |||
return new ReactRoot(container, true, hydrate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why async is hard-coded to true here vs being opt-in like hydrate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createRoot
is only useful in async mode, so the rationale is that if you're not async resilient, you should keep using the legacy API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. Sorry. Had written this comment before we chatted in person and forgot to remove it before submitting the LGTM.
@bvaughn I am not sure if we ever had a chance to talk about this change (I remember being CC'ed, but have been traveling a lot). If any of these are still relevant matters that you'd like to discuss, I am happy to chat. Been digging into |
Hey Mike. No worries. I sent you a message on Slack about it, but no, we didn't get the chance to talk. I have chatted with a few others about this approach, like Leland from AirBnb though. So far it seems like |
@bvaughn Is there any public slack channel I can join? :) |
I'm not aware of a public Slack channel. There's Reactiflux on Discord though. |
Makes createRoot the opt-in API for async updates. Now we don't have to check the top-level element to see if it's an async container.
Makes
createRoot
the opt-in API for async updates. Now we don't have to check the top-level element to see if it's an async container.