reading-notes

Class 401.15

Notes

Class 36 Whiteaboard

Readings

Dan Abramov Redux Tutorials

  1. What is the first principle of Redux?

    The first principle of Redux is that the state of your whole application is stored in one single object tree within a single store. This makes it easier to track changes over time and debug or inspect the application.

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

    A store holds the whole state tree of the application. The only way to change the state inside it is to dispatch an action. Reducers specify how the state changes in response to actions sent to the store. For example, when a user clicks ‘ADD_ITEM’, the reducer might add that item to the list in the state.

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

    The three methods are dispatch(), subscribe(), and getState(). dispatch() is used to send an action to the store to update the state. subscribe() allows you to listen for state changes, so you can update your UI accordingly. getState() is used to access the current state of the app.

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

    combineReducers() is a utility function provided by Redux. It helps to combine multiple reducing functions into a single reducing function. This is useful when our app state is divided into a few different parts, and we have different reducing functions that need to handle updates to different parts of the state. This way, each reducer only needs to worry about its own part of the state, making the code easier to understand and manage.

Things I want to learn more about

References