0

I am studying Vue.js (3).

I have a component which is used a lot of time (in a loop). The render is something like that :

enter image description here

This component makes a get (Axios) when it is created. So if I have 10 loops, I have 10 gets which return the same thing.

I try to make only 1 call (at the first component) and not the other calls, without the use of vuex. Is it possible in Vue.js and how to do that ? (I tried "mounted" instead of "created", without success).

1 Answer 1

1

You need to make the request in the parent component in which the loop is rendered. After that pass the response data as a prop to each item.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.