From the course: Building Modern Projects with React

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Refactoring the todos reducer

Refactoring the todos reducer

- Now that we've defined an is-loading reducer that tells us whether or not our application is in the process of loading our todos, we need to make some important changes to our todos reducer to reflect the fact that we're now loading data from a server. Currently, the todos that are displayed after our app is done loading data from the server aren't actually the todos that we get in their spots. They're still just our locally defined todos. What we're going to do in this video is make it so that our app actually displays the todos fetched from the server. So what we're going to do is open up reduced.js and we are going to incorporate three actions we created in a previous video, load_todos_in_progress, load_todos_success, and load_todos_failure into our todos reducer so that it works nicely with our loading flow. So here's what we're going to do. Down on our todos reducer, we are going to create cases for each of our…

Contents