S
S
Sergey750il2022-04-04 22:56:06
Vue.js
Sergey750il, 2022-04-04 22:56:06

How to wait for props values ​​to load?

Good day. The value of props is pulled from the api, but how in the child can you see that the props have loaded? I was sure that watch would work, but this did not happen.

watch: {
 chartData(){
        this.t.update();
     }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Albert Efremov, 2022-04-04
@AlbertName

In such cases, it's good to make a loader. And while the data is being loaded, we show the loader, and when they arrive, we show the components into which we forward the data received, filtered or processed for other tasks (for example).
Data loading should be tracked where this loading is initialized. But in any case, if the value of the prop changes, the component should re-render.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question