Write your answer…
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.
Hashnode is building a friendly and inclusive dev community. Come jump on the bandwagon!
💬 A beginner friendly place
🧠 Stay in the loop and grow your knowledge
🍕 >500K developers share programming wisdom here
❤️ Support the growing dev community!
Register ( 500k+ developers strong 👊)
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.