DEV Community

Discussion on: Do you need a State Management Library?

Collapse
hoandt profile image
hoandt

useContext and probably UseQuery from react-query are what I need.

Collapse
link2twenty profile image
Andrew Bone Author

What is it you like about useQuery? I tend to write my own fetch requests, even though that can lead to code repetition.

Collapse
hoandt profile image
hoandt

UseQuery caches fetched data. I would create a custom hook to handle the cache. Like useContext, you can get that cache globally.

It’s very handy to me when I apply it to store logged in user details.