When does the browser render in the event loop in JavaScript?
Between macrotasks. The event loop runs a macrotask, drains all microtasks, then renders (if needed, usually at 60fps). Then takes the next macrotask. Microtasks run before rendering.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Rendering and the Event Loop in JavaScript
Yes. The event loop drains all microtasks before rendering. If microtasks take longer than 16.6ms, the paint is delayed and a frame is dropped. Keep microtasks short for smooth rendering.
A callback that runs before the next paint. It syncs with the browser's refresh rate (usually 60fps). It is the correct way to do visual animations. Use it instead of setTimeout for animations.
A callback that runs when the browser is idle (between frames). The deadline object tells you how much time is left. Useful for non-critical work that should not cause frame drops.
Still have questions?
Browse all our FAQs or reach out to our support team
