Reputation: 27286
I am using Redux heavily in my application. I also have a very limited number of properties stored in Context:
Is this an antipattern and should I move everything over to Redux and dispense with Context altogether? I am inclined to answering yes. So the question is:
Are there valid use cases for using both Context and Redux in the same app or is it a code smell?
Upvotes: 1
Views: 137
Reputation: 7652
No I can't think of a single reason why it would be a good idea to use both. Generally "if you are using Redux only to avoid passing props down to deeply nested components, then you could replace Redux with the Context API".
If you need more advanced features, like predictable state container, async actions and so on, then choose Redux.
Pardon the pun, but "context switching" between the two is only going to confuse you, your app and future developers on your app.
in your case, username
stuff definitely could belong in a redux reducer and screen geometry information feels like it is basic enough to live in React and be passed down as props. although, this of course can be stored in Redux state too
Upvotes: 1