Redux Fundamentals

You can manage some application state without Redux, but everything that Redux manages goes into a single object called the store. Unrestricted access to the same state can reintroduce the errors that React’s prop system was meant to avoid. We need a system to enforce some constraints so that our application doesn’t devolve into a mess.

Redux solves this problem by preventing you from modifying the state directly. Instead, you create actions. Actions are similar to events like click and change, but describe high-level events unique to your application. For example, actions could be “Item added to cart” for an ecommerce application, or “Save requested” for a document editor. We’ll represent actions with JavaScript objects.

Get React for Real now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.