Redux is a JavaScript library that aims to simplify how we manage stateful data. Redux keeps all of our data in a single JS object called the Store. A single function, the reducer, is responsible for making modifications to the Store. We trigger the reducer by 'dispatching' an action - a JS object that describes how our data should change. The reducer function receives the action as an argument and makes changes accordingly. Other parts of the code (usually React Components) can subscribe to data in the Store. When data changes, Redux notifies subscribers of the change.

Did you find this post useful? Show some love!

I'm learning react and everyone talks about redux, but I still don't get it. It's like the model in MVC? Works with databases? It's just to manage objects data? Now I'm searching for real life examples but I don't understand the purpose

It's not so much a "model" as a paradigm for data flow in your application.

Think of how data and actions occur in your application: A user clicks on a button, say to increase a quantity in a shopping cart. With redux, you have a single source of data for your application (the "store" mentioned in the post). When the user clicks the button, it triggers an action (for example {"INCREASE_QTY", value:1}). The reducer catches that action and its value and modifies the overall state of data in your application. Your application - say, a React component, now receives updated data down from the store and modifies its display state.

Data flows one direction in your application, rather than climbing back up the tree. Overall, I find, it creates less headaches.

Here's an image of what I'm trying to get at: devangelist.de/wp-content/uploads/...

ohh thanks! That's explain what I need and the image describes the point perfectly. I'm sure that I need more practice to realize redux potential.

Np. It takes a minute to wrap your head around when it’s new, but once you get it, it’s incredible! All the best on your learning!

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

Hows about:
ReduxJS is how you can have globals in javascript without losing the plot.

Request : Node, Polymer, Angular 4

If only it was that easy in practice.

THIS IS IT : simple and accurate , thanks for the effort Ross

Very helpful bee-line through the BS!

Classic DEV Post from May 7

Who's looking for open source contributors? (May 7 edition)

Please shamelessly promote your project. Everyone who posted in previous weeks ...

READ POST
Follow @ben to see more of their posts in your feed.
Ross Creighton
Member since Jan 18, 2017
More from @ross
CSS Flexbox in 30 seconds
#css #inthirtyseconds
CSS Modules in 30 seconds
#css #inthirtyseconds
Trending on dev.to
Best Automated Testing Tools for 2018
#testing #selenium #devops #javascript
Would you contribute to a JavaScript OSS Project that uses static types?
#discuss #javascript #flow #typescript
Explain RxJS Like I'm Five
#explainlikeimfive #javascript
How did you learn to flex your CSS muscles?
#discuss #css #frontend #react
JavaScript Quiz Part 3
#webdev #javascript #challenge
Who are up to talk to and advice or seek for it?
#discuss #javascript #showdev
What is a Web Framework, and Why Should You use one?
#beginners #webdev #javascript #react
Makin' Bacon with Node.js, Hapi, and Vue
#node #hapi #vue #javascript