...

/

Asynchronous Action Creators

Asynchronous Action Creators

Learn about the async action creators in server communication.

We'll cover the following...

Let’s start by looking at a server communication implementation with async action creators using the redux-thunk library to understand the underlying pitfalls of this approach:

const fetchUser = id => dispatch =>
  axios.get(`http://api.ourserver.com/user/${id}`)
    .then(({ data: userData }) => dispatch(setUserData(userData)));
...