Combining Various Pieces of Global State
Learn setting up Redux store in React Native using Redux Toolkit, covering reducer config, React integration with Provider, and resolving unhandled action type error in likedImages reducer.
We'll cover the following
We have two reducers, each one meant to manage two different actions. What we need to do now is create a store that will represent the global state of the Funbook app and pass actions into reducers. We could use the createStore
function from core Redux, but that would require adding more boilerplate files and functions, and it is not the recommended approach for modern Redux.
Using Redux Toolkit
The recommended approach is using Redux Toolkit, which we will do right now. Redux Toolkit offers a special configureStore
function, which will do a lot of heavy lifting for us. All we need to do is add this function:
Get hands-on with 1400+ tech skills courses.