DEV Community

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

Collapse
 
monisnapjulien profile image
Julien

Thank you for the comment !

You can maybe create a component that takes a promise in parameter and 3 slots :

  • loading component
  • error component
  • success component using the result of the promise (passed in props maybe ?)

In Flutter there is Riverpod AsyncValue, but in Vue it's not as easy and type-safe. Hope that helps 😉

Collapse
 
vadim profile image
Vadim

Interesting! I will try. Thank you