Handling Loading Actions: The Proper Way in Reduxby@mtroskot
23,469 reads
23,469 reads

Handling Loading Actions: The Proper Way in Redux

by mtroskot14mJanuary 7th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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

@mtroskot

Share Your Thoughts

About Author

mtroskot HackerNoon profile picture
mtroskot@mtroskot

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
L O A D I N G
. . . comments & more!