Skip to content
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

Add note about root.render microtask scheduling #7717

Merged
merged 4 commits into from
Apr 8, 2025

Conversation

jukben
Copy link
Contributor

@jukben jukben commented Apr 4, 2025

This PR adds documentation about the microtask scheduling behavior of createRoot().render(), as requested in #7317 and confirmed by the React team in facebook/react#32811.

The documentation clarifies that while rendering is synchronous once it starts, the render() call itself is scheduled in a microtask, similar to how setState works. This can be important when integrating with code that depends on precise effect timing (remix-run/react-router#12459)

Fixes #7317
Closes facebook/react#32811

Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@eps1lon eps1lon merged commit e148ffe into reactjs:main Apr 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants