August 2017
Beginner
374 pages
10h 41m
English
Until now, we only handled the _SUCCESS action types of our FETCH actions. Now, we will make use of the _REQUEST action types and show a loading indicator while requests are pending. We will accomplish this by storing pending requests in an object, as follows:
{ FETCH_USER: 2, FETCH_POSTS: 1}
The preceding state would mean that there are two FETCH_USER and one FETCH_POSTS request pending. If the object is empty or all values are 0, we are not waiting for anything. Otherwise, we will show the loading indicator.
Read now
Unlock full access