0

I have a layout file in which I have some data. Besides that I have three components:

  • tags
  • students
  • actions

I want to declare the data in the layout file, but access it through the three child-components.

How is this done in Vue.js?

Thank you for your help.

1 Answer 1

1

One option can be to pass the props to all the child components which is the norm in vue when it comes to passing data to child component, as also explained here.

Given that you want to pass same data to all these components and there can be cases going forward when you want to change this data and get it reflected in parent as well, you can go for a centralised state management, which is explained here in more detail.

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

2 Comments

ok, so I should go with VUEX ? I'm familiar with the concept of state, but have no clue what actions look like!
Yes, Vuex is in general recommended and popular in community, you can get more details from the docs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.