From the course: Building Modern Projects with React
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Keeping track of the loading state - React.js Tutorial
From the course: Building Modern Projects with React
Keeping track of the loading state
- [Instructor] All right, so now that we have this server that our front end is going to be loading data from, the next thing that we're going to need to do here is we're going to need to actually create another reducer, right? Another slice, like what we see here, in order to keep track of the loading state of our application, right? When we send a request, as we just did with Postman here, there's a small amount of time where we're still waiting for those todos. And so during that time, we'll probably want to display some sort of loading message so that the user knows why they're not seeing anything in the application. So in order to make this work, we're going to have to create something sort of like this todos slice. But what we're going to do, we'll create a new file and we'll call it something like loadingSlice.js. And this is just going to be sort of a separate slice that keeps track of the current loading state of the todos. So I'm actually going to copy most of this stuff…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Why do we need Redux-Thunk?1m 49s
-
(Locked)
How does Redux-Thunk work?1m 47s
-
(Locked)
The Todos API4m 6s
-
(Locked)
Keeping track of the loading state4m 8s
-
(Locked)
Loading data with Thunks10m 35s
-
(Locked)
Refactoring the to-dos reducer6m 25s
-
(Locked)
Using Thunks to create server resources7m 56s
-
(Locked)
Using Thunks to delete server resources5m 30s
-
(Locked)
Challenge: Using Thunks to update server resources38s
-
(Locked)
Solution: Using Thunks to update server resources3m 47s
-
(Locked)
-
-
-
-