2👍
✅
There are many ways to tackle this. You can create a Vuex getter which supplies you a null value or default value to start with. This will at least ensure no errors and it will update whenever your store kicks into gear.
You could create a local computed property and fetch your store value with a mapGetter
this way you can also supply a default.
You could have totalPages
be set to 0 and use a watcher to update the value whenever your store value changes.
It really depends on context. For example a Vuex getter will be helpful if you need the same default fallback for other components who retrieve the value.
Source:stackexchange.com