From the course: Building Modern Projects with React

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Adding another reducer

Adding another reducer

From the course: Building Modern Projects with React

Start my 1-month free trial

Adding another reducer

- [Instructor] So we just added three more actions to our application and we implemented a loadTodos thunk that will handle the logic of loading data from our server as well as dispatch other actions and thunks depending on what happens during loading. What we've got to do now is right some code that will take these actions that our loadTodos thunk is dispatching and make corresponding changes to the Redux store when each of these actions occurs. Now as you may have guessed the additions we're going to make to our code will be in the reducers file so let's open up reducers.js and the first thing we're going to do here is import the three action types we just defined. So let's rearrange this a little bit to make it more readable. And to this list we're going to add LOAD_TODOS_IN_PROGRESS, LOAD_TODOS_SUCCESS and LOAD_TODOS_FAILURE. And now we have to ask ourselves what changes we expect to see in our Redux store whenever each of…

Contents