Post

Lots of insights here about callback refs!

Sathya@gsathya.bsky.social

I'd store the id in a ref and check that manually and not depend on useCallback: ``` const idRef = useRef(null); const scroller = (node) => { if (idRef.current === null || idRef.current !== id) { node?.scrollIntoView({ behavior: "smooth" }); idRef.current = id; } }; ```

0 reposts2 likes

No replies yet.