DEV Community

Cover image for Does React Hooks Replace Redux: Where to use Which?
Kat Holder
Kat Holder

Posted on β€’ Edited on

2

Does React Hooks Replace Redux: Where to use Which?

Redux vs React Hooks is a pretty much old debate. Which one to go for and which may be replaced by what. Let's find out.

What is Redux?

Redux is a predictable state management library and architecture which easily integrates with React.
The primary selling points of Redux are:

  • Deterministic state resolution (enabling deterministic view renders when combined with pure components).
  • Transactional state.
  • Isolate state management from I/O and side effects.
  • Single source of truth for application state.
  • Easily share state between different components.
  • Transaction telemetry (auto-logging action objects).
  • Time travel debugging.

To put it another way, Redux provides you with superpowers in terms of code structure and debugging. It's easier to write more maintainable code, and it's a lot easier to figure out what's wrong when anything goes wrong.

What is React?

React hooks let you use state and React lifecycle features without using class and React component lifecycle methods. They were introduced in React 16.8.
The primary selling points of React hooks are:

  • Use state and hook into the component lifecycle without using a class.
  • Colocate related logic in one place in your component, rather than splitting it between various lifecycle methods.
  • Share reusable behaviors independent of component implementations.
  • It's worth noting that these wonderful benefits don't actually overlap with Redux's. To obtain consistent state updates, you should indeed utilize React hooks, but that has always been a part of React, and Redux's deterministic state model fits right in. That's how React allows for deterministic view rendering, and it's one of the main reasons for the framework's inception.

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay