DEV Community

Discussion on: Is Redux Needed After Hooks?

Collapse
 
lysofdev profile image
Esteban Hernández

Hey Daniel, hooks are an implementation of the function composition pattern made popular by the recompose library. They're purpose is to abstract logic and make it reusable and available to multiple, function components. The biggest difference here is the ability to instantiate a state and to access life cycle events. However, hooks are not a replacement for Redux. If any feature was to replace Redux, it would be Context not Hooks. We use Redux to avoid Top-to-Bottom state management by allowing some application state to be shared by unrelated components. Essentially, if two parallel components share state, we use Redux to avoid having to create a parent component whose sole purpose is to manage state for those two parallel components. Finally, you can use hooks to interact with Redux but not replace it.