DEV Community

Discussion on: The Best Way to use Actions in VueJS

Collapse
 
andreiculda profile image
andreiculda

Good article and nice extrapolation for a global proxified Vuex action, but this has one drawback as far as I see. What happens when you need to have more than one global state loading button on the same page?

Collapse
 
veebuv profile image
Vaibhav Namburi

Hey mate!

Thanks for the comment and great question!

If you want to build a system where there's multiple loading states, instead of following a binary toggle function, I would do what was mentioned in the beginning of the blog and have an object with key value pairs of the async actions that are currently active and have loader states subscribe to those actions