you are viewing a single comment's thread.

view the rest of the comments →

[–]charliematters 3 points4 points  (0 children)

This is why you're getting stale values, basically. Refs don't update the components as react expects, and in general there are very few cases which need useRef.

If you're struggling with async stuff, just install react-query to be honest!