arrow_backBACK TO DRILLS
Black BeltuserefPREMIUM
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?