DEV Community

Discussion on: Implementing State Management using Context API and Hooks in React

Collapse
 
dance2die profile image
Sung M. Kim • Edited

Only yesterday, I finally gave in and replaced contexts with redux store.

To easy the pain, I used easy-peasy, which wraps Redux underneath the hood.

In my case, the migration was snappy as I was following Kent C. Dodd's Context Pattern mentioned in How to use React Context effectively, which exposes state & actions/dispatch separately via hooks, which is what Easy-Peasy does.

The upside was that, I was forced to "group" related states and actions together.

The reason my context approach was getting out of hand was, not because of any issues Context API (well, it does trigger re-render when it's updated everywhere) but because I was dumping all possible states without organizing them.