reading-notes

Class 401.15

Notes

Readings

Redux Toolkit (RTK)

  1. What concerns are addressed by Redux Toolkit?

    Redux Toolkit simplifies Redux application development. It includes utilities to automate routine tasks such as action creation, reducer creation, and store setup.

  2. What does configureStore() do?

    configureStore() simplifies store setup by automatically configuring middleware, enabling the Redux DevTools extension, and allowing for reducer functions to be split and combined.

  3. How would I use createSlice()?

    createSlice() automatically generates action creators and action types based on the reducer and slice name you provide. For example, you would use it as follows: const counterSlice = createSlice({name: 'counter', initialState: 0, reducers: {increment: state => state + 1}});

MobX

  1. What is Mobx?

    MobX is a state management library for JavaScript applications. It emphasizes transparent reactive programming and enables efficient derivation of state from one or more sources.

  2. How does MobX make it “impossible” to produce an inconsistent state?

    MobX ensures a consistent state by using observables and reactions. Changes in observables trigger reactions that automatically update the state, ensuring all parts of your application stay up-to-date and consistent.

  3. How would we build a reactive user interface?

    To build a reactive UI with MobX, you would make your application state an observable and your UI a reaction. When the state updates, MobX automatically propagates these changes to the UI. For example, in a React component, you would use observer from ‘mobx-react’ to make your component reactive.

Things I want to learn more about

References