blog

Redux vs local state

When I say local state I mean useState or reducer/context pattern (even if it’s placed at app root).

If there is a question of whether to use local state vs Redux, I always prefer using Redux. My reasons:

Note that many things in Preact/React can be solved using useState. I’m not advocating to hold ALL of the state in Redux. But there are situations where you need some kind of state to solve a problem and are uncertain about keeping it simple or preemptively preparing for scale.

When to use local state: