| Yes and no. The main point of Redux is to make your state updates predictable and traceable throughout the codebase. Sure, you can create a global object and stuff your data in there. But, if any random part of the app is allowed to modify that object at any time, then it's a lot harder to understand how your app got into a particular end situation. Redux is based on the "Flux Architecture" concept, and asks you to follow restrictions on how you structure your logic. Only certain functions are allowed to update the state, and in order to run that logic, you create plain JS objects called "actions" that describe some event or update that needs to occur, and ask the update logic to determine the new state values in response. This adds a level of indirection to your code, but it provides a way to log and trace when, where, why, and how a given piece of state got updated. If you've got about 45 minutes, I did a "Redux Fundamentals" presentation at Reactathon a few months ago that walks through the basic principles of Redux. Here's a link to the video and the slides: https://blog.isquaredsoftware.com/2018/03/presentation-react... |