Question · JavaScript and React course · Module 9: Modern React Hooks
Automatic Batching and setTimeout
How does automatic batching in React 18 change the behavior of state updates inside setTimeout?
Answer options
- setTimeout is not supported by React 18 and useTransition should be used instead
- React 18 automatically replaces setTimeout with requestAnimationFrame
- Updates in setTimeout are still executed synchronously, with one re-render per update
- State updates in setTimeout are now batched into a single re-render, just like in event handlers
You can check the correct answer by solving this task in the CodeWorlds game.