1. 16
    Dispatch Asynchronous Actions with Redux Thunk Middleware
    8m 29s

Dispatch Asynchronous Actions with Redux Thunk Middleware

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

In this lesson, we’ll be retrieving data from the server as well as posting new data to the server using fetch. We’ll make this work with Redux using the Thunk Middleware which will allow us to dispatch asynchronous actions.

Joseph Cooper
Joseph Cooper
~ 4 years ago

Weird, I've been following this tutorial to a T yet I'm getting an error stating that res is not defined in the todoServices file. I'm still a bit of a noob to async code, any idea why this might be occurring?

José Tapadas Alves
José Tapadas Alves
~ 3 years ago

Please notice that you need to import the thunk differently:

import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import reducer from './reducers/todo';

export default createStore(reducer, applyMiddleware(thunkMiddleware));