- Let's open the redux/index.js file and import the createStore function from redux, as follows:
import { combineReducers, createStore } from 'redux';
- Creating the store is extremely simple; all we need to do is call the function
imported in step 1 and send the reducers as the first parameter, as follows:
const store = createStore(reducers);export default store;
- That's it! We've set up the store, so now let's dispatch some actions. The next steps in this recipe will be removed from the final project since they're for testing our setup. Let's start by importing the action creators we would like to dispatch:
import {
loadPhotos,
addPhotos,
removePhotos,
} from './photos/actions';
- Before dispatching any actions, let's ...