From the course: Building Modern Projects with React
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Loading data with Thunks - React.js Tutorial
From the course: Building Modern Projects with React
Loading data with Thunks
- [Instructor] All right, so now that we've created our loading slice, the next thing that we're going to do is we're going to see how to actually start using thunks to load data from our server. Now, there are actually two things that we're going to need to do to make this work. The first thing we're going to need to do is add /api to the start of all of our server routes. Now the reason we have to do this is so that when we make a /api request from our front end, it will know that it's supposed to proxy that to the server. Don't worry too much about that. Basically, this just makes it easier to run these things together in development and send requests between them. So now that we've done that, make sure you add that in four places here. The next thing we're going to need to do is go into this vite.config.js file and we're just going to need to tell our React Vite application that we want it to proxy requests to the server, right? This will save us from having to specify the entire…
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)
-
-
-
-