You’ve seen how verbose working with Redux can be. If you think there are a lot of moving parts and semantics to remember, you’re not alone.
Some common issues/complaints people have when using Redux include:
- “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.”
- “Writing immutable updates is too error-prone.”
Fortunately, the Redux team created Redux Toolkit to address these concerns!
Redux Toolkit contains packages and functions that are essential for building a Redux app. It builds in the best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications.
Because of how effective it has proven to be at addressing the concerns of the verbose “hand-written” logic of the past, Redux Toolkit has become the preferred way to write Redux application logic.
In this lesson, we’ll be covering two essential methods: createSlice()
and configureStore()
. If you want to learn more about the remaining methods that Redux Toolkit has to offer, head over to the Redux Toolkit docs!
Instructions
In the code editor, take a moment to look at the contents of favoriteRecipesSlice.js and store.js and familiarize yourself with the reducer, action creators, selectors, and the store
object.