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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jukben
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Suggestion] Document the usage of flushSync with createRoot.render for synchronous rendering
2 participants