DEV Community

Discussion on: 💡 Vue Typescript State Management : We can do better than “isLoading” in 2022

Collapse
 
jcuervas profile image
jcuervas

Although is an elegant solution, you are just replacing a boolean loading for a state loading, as each element need a different variable to track it's loading state in both cases.

Collapse
 
monisnapjulien profile image
Julien

Thanks a lot for the comment ! :)

Indeed it's not a time saver, you don't use less code. However, the proposed way is, in my opinion, for easier readability, extensibility and consistency by using a single variable with a better naming to handle a common "async action state", including the error state that is sometime forgotten 😅