In the simplest way possible, can some here explain how react and redux work?

Write your answer…

3 answers

React components define events (clicks, scrolls, etc. etc.) and dispatch actions to redux. Redux takes those actions, modifies the state of your application (with reducers), and hands the fresh state to your react components to render.

In reality there are many ways to convolute and modify this basic structure but, in the end, it's all just state being modified and rendered.

Reply to this…

Hashnode is a friendly and inclusive dev community.
Come jump on the bandwagon!

  • 💬 Ask programming questions without being judged

  • 🧠 Stay in the loop and grow your knowledge

  • 🍕 More than 500K developers share programming wisdom here

  • ❤️ Support the growing dev community!

Create my profile

Redux is basically a client state manager for your application. Means a dedicated object known as store, which is used to store the entire data that your app generates and receives from network calls at a centralized place.

The changes in store (object) can be done only by dispatching actions which are further processed by reducers (Function to actually modify the state object).

Why use Redux : At any moment you can guess the state of any application, easier to debug issues, and lot more...

Now suppose, you want to publish some data in your view template.. You just take the data from your store and show it. Any change in the view dispatch some action (simple js object that defines the operation and carries the data) which get processed by reducer and updates the state. Now your view will get new data from the current state.

This means the data flow is unidirectional unlike Bi-Directional in 2 way data binding where any change in view gets reflected in model and vice versa.

To make redux more safe their are few libraries like Redux Thunk & Redux Saga which extends the functionality and handles asynchronous operations in more redux friendly way.

Reply to this…

I wrote a Redux tutorial aimed specifically at beginners. Redux has a steep learning curve and it could be difficult to understand every concept without a clear guidance. Here is my React Redux tutorial for beginners. Enjoy!

Reply to this…

Isioye Mohammed's photo

Joined on

Jan 3, 2018

Welcome to Hashnode
the dev community

The programming forum to discuss topics broader than bugs and issues, write and share knowledge and connect with the best developers.