My FeedDiscussionsHeadless CMS
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How to handle multiple Ajax requests when using Redux or any other state container?

Nirmalya Ghosh's photo
Nirmalya Ghosh
·Jan 24, 2017

Suppose you have a bunch of toggles and they all fire async requests. Now, how would you fire the requests? Would you store all the requests in a queue and fire only the last request since it would contain the current ui state? Or, would you fire one request and disable the component while that request is being fired?

Consider that you're using Redux (or any predictable state container) which can store the current snapshot of your ui state. Also, consider that you're using the fetch api.

If there is any other way you can handle this situation, please comment.

TIA.