DEV Community

Discussion on: React Best Practices

Collapse
 
yagoroliveira profile image
Yago R. Oliveira

One question, what you think about Context API with React Query Library and Unstated-next for a large application?

Collapse
 
jwhenry3 profile image
Justin Henry • Edited

I'd advocate for a provider-less state tool like zustand (given the state is global)
github.com/pmndrs/zustand
Though, I can see the benefit of the provider pattern if you want multiple scoped states...

React query is great, and keep in mind there is also SWR
swr.vercel.app/

EDIT: After looking at unstated-next, I heavily support its usage in cases where you want multiple instances of a state (maybe you have separate thread management for a messaging app, and you want those states isolated).
I push for zustand for global state and unstated-next for localized state.

Collapse
 
awedis profile image
awedis • Edited

Used before Context API with GraphQL though, the code was much simpler and cleaner, I believe in order to choose which state management to use we need to check the whole app state & how much we have global data. Yep and regarding the Unstated-next it's a good library that can be integrated with Context API.

Collapse
 
akhalinem profile image
Abror Khalilov

Interested