[Vuejs]-Async vuex fetch action state filled if using variable in template getting error undefined

0👍

app/app is initially null, and your template does not have a null check on app.name, which results in the error you saw. You can either conditionally render app.name in the template:

<template>
  <div>
    <template v-if="app">
      {{app.name}}
    </template>
  </div>
</template>

Or use the empty string as app/app‘s initial state instead of null in your store.

Leave a comment