In which situations should I use useRef?

Asked

Viewed 29 times

0

I recently read an article entitled You’re overusing useMemo: Rethinking Hooks memoization. In it, I saw something interesting that I hadn’t thought of before, using the useRef to store object references instead of useMemo.

I thought the useRef should be used only to store references of DOM elements. So the questions I have are:

  • The useRef really is the most appropriate hook to keep objects reference?

  • There is another use case for the useRef?

  • How does the behavior of mutable references that are referenced in other Hooks look like useEffect and useCallback?

  • very broad your question ...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.