Q59: How does flushSync interact with browser microtask queues?

ReactDOM.flushSync() forces React to immediately execute pending state updates and flush the associated DOM updates synchronously. Because it bypasses React's normal batching queue, it drains pending state microtasks immediately within the current call stack, making DOM measurements available instantly.

Key Takeaways
  • flushSync() forces synchronous DOM re-renders within the immediate call frame.
  • Should be used sparingly as frequent forced synchronous flushes degrade frame rates.
Knowledge Check

What is a major performance drawback of calling flushSync repeatedly in rapid succession?