D
D
Denioo2020-07-17 12:41:12
Vue.js
Denioo, 2020-07-17 12:41:12

How to solve mounted hook vue issue?

Hello, how can I solve the mounted hook problem:

vue.esm.js?a026:628 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'cars' of null"

The fact is that when updating the page in one of the components where mounted is used, such a problem arises. The data in the store has not yet been downloaded from the server, and this component uses a mounted hook in which actions with the store take place. How can it be solved? Checking for null or an empty array in a hook doesn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-07-17
@Fragster

Show a stub component instead of the "main component" until everything is loaded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question