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
From the course: Building Modern Projects with React
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Why do you need Redux Thunk?1m 57s
-
(Locked)
How does Redux Thunk work?2m 51s
-
(Locked)
Adding Redux Thunk to React2m 30s
-
(Locked)
Creating a thunk3m 30s
-
(Locked)
The Todos API2m 18s
-
(Locked)
Async thunks5m 56s
-
(Locked)
Adding another reducer7m 19s
-
(Locked)
Refactoring the todos reducer2m 50s
-
(Locked)
Using thunks to create server resources5m 58s
-
(Locked)
Using thunks to delete server resources4m 46s
-
(Locked)
Challenge: Using thunks to update server resources1m 14s
-
(Locked)
Solution: Using thunks to update server resources3m 34s
-
-
-
-
-