arrow_backBACK TO DRILLS
Black BeltusereflockPREMIUM

flushSync before DOM measurement

A component adds an item with setTodos() and immediately calls listRef.current.lastChild.scrollIntoView(). The scroll always targets the previous item instead of the newly added one. Why does wrapping the state update in flushSync fix this?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.