3 ms·
It's state storage. If you've got any familiarity with Backbone, all of your Models and Collections define the current set of data for your application. You m
by acemarke 11y ago
It's state storage. If you've got any familiarity with Backbone, all of your Models and Collections define the current set of data for your application. You may also have a lot of UI-related state, like which tab is selected, which pane is open, etc. Redux lets you put all that information into one place (although how much or how little of your state goes in there is up to you).
It also defines certain conventions around updating that data. In Backbone, anyone with a reference to a Model can call myModel.set("someField", someValue) at any time. In Redux, "write" logic is isolated to a user-defined set of "reducer functions", which only respond to specific types of messages. This makes it _very_ easy to determine when and why a particular bit of data changed. In addition, it enables scenarios such as storing the entire list of dispatched actions, and then playing back each action step-by-step to allow you to see how you got to a given state in your application (aka "time-travel debugging").