Redux - Additional Topics

My reading notes for Code Fellows


Redux - Additional Topics

Redux Toolkit (RTK)

What concerns are addressed by Redux Toolkit?

The Redux Toolkit package is intended to be the standard way to write Redux logic. It was originally created to help address three common concerns about Redux:

“Configuring a Redux store is too complicated” “I have to add a lot of packages to get Redux to do anything useful” “Redux requires too much boilerplate code”

What does configureStore() do? configureStore(): wraps createStore to provide simplified configuration options and good defaults. It can automatically combine your slice reducers, adds whatever Redux middleware you supply, includes redux-thunk by default, and enables use of the Redux DevTools Extension.

How would I use createSlice()?

createSlice(): accepts an object of reducer functions, a slice name, and an initial state value, and automatically generates a slice reducer with corresponding action creators and action types.

MobX

What is Mobx? MobX is a standalone library that can be used as a state-management tool.

How does MobX make it “impossible” to produce an inconsistent state? MobX makes sure that everything that can be derived from the application state, will be derived. Automatically.

How would we build a reactive user interface? Use an observer opattern: This pattern consists of an observable object, that is, some object that contains data of interest, and which also maintains a list of subscribers called observers. When the data changes, the observable object notifies all of the observers that are currently subscribed.

Tutorial

What take-away(s) did this tutorial provide? The makers of this product and its documentation are cautioning against not using the Redux Tool Kit, because of its ability to integrate much f the functionality that base users had to work wrd to achieve, and which often led to errors.