0👍
✅
You are trying to access a property of null
type. That’s why you are getting the error.
<div v-if="error.show" class="error">{{ error.message }}</div>
In the above line, you are trying to access error.show
but from the global store, the returned error
value is null
type.So you are trying to access the show
property on a null
type and thus getting the error.
There are many solutions to handle this. Either, you can just check it in the computed property, or you can use simply add optional chaining like this
<div v-if="error?.show" class="error">{{ error.message }}</div>
Source:stackexchange.com