If you are fetching data from a server, your app needs to manage that relationship. The redux manual demonstrates the need for at least three action: FETCH_REQUEST
, FETCH_FAILURE
, and FETCH_SUCCESS
. The redux manual's reddit example shows a slightly different setup, omitting the FAILURE
and renaming SUCCESS
to RECEIVE_DATA
.
Long story short, we need to expose the API data fetching lifecycle to our app.
Fetching lifycycle:
- begin fetching
- receive data or receive error (or bail when cancelled)