Basics
Explore how to simplify Redux workflows by shifting asynchronous logic from action creators to middleware. Learn to create plain object actions and handle server communication declaratively for easier testing and maintenance.
We'll cover the following...
We'll cover the following...
We can now take the previous example and encode the differences in the action’s payload. We initially had the following:
const fetchUser = id => dispatch =>
axios.get(`http://api.ourserver.com/user/${id}`)
.then(({ data: userData }) => dispatch(setUserData(userData)));
const fetchComments = id => dispatch =>
...