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.
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?
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));