Handling Loading Actions: The Proper Way in Reduxby@mtroskot
22,866 reads

Handling Loading Actions: The Proper Way in Redux

January 7th 2020
14 min
by @mtroskot 22,866 reads
tldt arrow
Read on Terminal Reader🖨️
JS🚫

Too Long; Didn't Read

Don’t put UI logic into reducers instead put it into a separate reducer. When handling asynchronous actions in your application, most of the time you want to let users know that their request is being executed in form of some loading indicator. The problem is that in our case news can be FETCHED, PUBLISHED, UPDATED, DELETED, REFRESHED and to display loading indicators for each action on different parts of the screen we would need to have 5 flags. Having booleans in. reducers for loading flags has its limitations. Everytime we want to start and stop a loading action we have to do it manually.

Company Mentioned

Mention Thumbnail
featured image - Handling Loading Actions: The Proper Way in Redux
mtroskot HackerNoon profile picture

@mtroskot

mtroskot
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa