in VueJS by
Is recommended to use async for computed properties?

1 Answer

0 votes
by

No, it is not recommended. Computed properties should be synchronous. But if you still use asynchronous actions inside them, they may not work as expected and can lead to an unexpected behaviour.

For example, the below usage of async/await is not recommended,

 async someComputedProperty () {
      return await someFunction()
    },

Note: If you still prefer to use async computed properties for some reason then you can consider using additional plugin such as vue-async-computed.

...