Reading-Notes

Reading

Dan Abramov Redux Tutorials

What is the first principle of Redux?

Now you know the first principle of Redux, which is that, everything that changes in your application, including the data and the UI state, is contained in a single object, we call the state or the state tree.

What is a store and what do we use our reducers for within that store?

A store is a central repository that holds the entire application state. It is typically implemented using a library like Redux. The store is responsible for managing the state of the application and providing a way to access and update that state.

The store in React acts as a single source of truth for the application’s data. It holds the state in a plain JavaScript object and provides methods to interact with it. Components can subscribe to the store to receive updates when the state changes and dispatch actions to modify the state.

Reducers, on the other hand, are pure functions that define how the application state should change in response to dispatched actions. Reducers take the current state and an action as input and return a new state object. They should not mutate the existing state; instead, they create a new state object that reflects the desired changes.

Reducers play a crucial role in the store by handling different types of actions and updating the state accordingly. When an action is dispatched, the store invokes the relevant reducer, passing the current state and the action as arguments. The reducer then determines how the state should be modified based on the action’s type and returns the updated state.

By using reducers within the store, you can separate the concerns of state management from the components themselves. Components can focus on rendering the UI and dispatching actions, while the store and reducers handle the logic of updating the state. This promotes a more structured and scalable approach to managing application state in React.

Name three Redux store methods given to us by createStore and describe their use.

Explain to a non-technical recruiter what combineReducers() does and why it is useful.

combineReducers() is a helpful tool in Redux that allows us to organize and manage the state of a complex application. It divides the state into smaller parts, each handled by a separate reducer. Think of it as a way to organize items in different boxes. This helps keep our code organized, maintainable, and allows multiple developers to work on different parts of the application more efficiently. In short, combineReducers() simplifies state management in Redux and makes our code easier to understand and maintain.

Bookmark and Review

worlds easiest guide to redux

testing reducers

Redux Docs

Additional Questions

Looking ahead at this module’s course schedule, What do you look forward to learning?

Hopefully just able to retain the information.

What are your learning goals after reading and reviewing the class README?

Be able to use all the cool tools appropriately!