Skip to content

No need redux if I use swr? #587

Answered by sergiodxa
devhyunjae asked this question in Q&A
Discussion options

You must be logged in to vote

I haven't used Redux again since I started using SWR, most of the time the only global data you put in Redux is API state, with SWR that data is on SWR cache so there is no need for Redux.

However, you may still want to have global state, in that case you can rely on Redux, Context, MobX or any other solution, IMO most of the time with only using useState/useReducer + Context is enough. If you think most of the global state of your app are things like the current theme (you will use a ThemeProvider for that usually), internationalization (you will use an IntlProvider for that) and a few custom things you may need for which you could create a specific provider to each type of data and avoi…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@devhyunjae
Comment options

@abdelhamid-attaby
Comment options

@gadingnst
Comment options

Answer selected by devhyunjae
Comment options

You must be logged in to vote
1 reply
@codthing
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants