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.
How does Redux Thunk work?
From the course: Building Modern Projects with React
How does Redux Thunk work?
- [Instructor] So now that we know the basic goal of Redux Thunk, how does it work exactly? Well basically, Redux Thunk works by sort of tapping into the normal Redux dataflow. That is, if we have our normal unidirectional dataflow, where our components trigger actions, those actions cause predictable changes to the data in our Redux store, and these data changes are then reflected in our components, Redux Thunk allows us to add a sort of fork into this loop where we can put the logic for our side effects. Whether that's loading data or performing some other asynchronous operation. So what this looks like, more or less, is that our components can dispatch a regular Redux action, which goes straight to the reducer and makes the relevant changes to the store or our components can dispatch a Thunk that performs whatever async or conditional operations we want and then dispatches its own Redux actions based on the result of those…
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
-
-
-
-
-