From the course: Building Modern Projects with React
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using thunks to create server resources
From the course: Building Modern Projects with React
Using thunks to create server resources
- [Narrator] Currently our app is loading and displaying server data correctly. But even though it looks like it's creating new Todos correctly, for example, if we add one up here, when we create a new Todo, the changes only take place locally. Our new Todos aren't persisted in the server. In this video, we'll see how to make this happen using thunks. So, if you remember from an earlier video, and I'm just going to use Postman here for a second to demonstrate something, the way we create a Todo on our server is by sending a post request to the Todos endpoint, with the text for the new Todo as the body of the request. If we send this request, the server will then create this new Todo and return the created Todo as the response to our request. Now our server will also add a unique ID, a createdAt property and an isCompleted property to our Todo for us, so we'll want to be sure to save the Todo that we get back…
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
-
-
-
-
-