How does useRef differ from useState?
Answer out loud or in your head first, then compare.
Answer
Changing state with useState tells React a new render may be needed. useRef keeps a value between renders, but changing ref.current doesn't by itself trigger a refresh of the view.
A ref is useful for accessing a DOM element, a timer ID or technical information that isn't shown on screen. If a number should be visible and update the UI, it should usually be state. Don't move everything into refs just to “cut renders”, because you can lose the link between data and view. A ref also isn't shared memory between independent instances of the app.
Why it matters: Helps separate UI data from the details of handling operations.
Possible follow-ups: How do you store the AbortController of an active request?
How did it go? Be honest — “Not yet” puts the question on your review list.
Related questions
Further reading
- React: Synchronizing with Effects(opens in a new tab)Docs; accessed 22.10.2026. What Effects are for, cleanup, and protecting against stale results.