Skip to content

Add note about root.render microtask scheduling - #7717

Merged
eps1lon merged 4 commits into
reactjs:mainfrom
jukben:add-render-microtask-note
Apr 8, 2025
Merged

eps1lon merged 4 commits into
reactjs:mainfrom
jukben:add-render-microtask-note

Conversation

@jukben

@jukben jukben commented Apr 4, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds documentation about the microtask scheduling behavior of createRoot().render(), as requested in #7317 and confirmed by the React team in react/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 react/react#32811

Comment thread src/content/reference/react-dom/client/createRoot.md Outdated
Co-authored-by: Sebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>

@eps1lon eps1lon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you

This branch was successfully deployed

1 active deployment
Preview — eca7e29e Deployed Apr 7, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants