DEV Community

Discussion on: Vue.js Pattern for Async Requests: Using Renderless Components

Collapse
 
tiagosmartinho profile image
Tiago Martinho

Whoooa, good solution.

I am trying to reproduce your solution and a question has come up. my goal is to pass data torouter-view, I am now passing as props, but I do not know if it is the best solution?

On each page I have a variable corresponding to the page that will work this data.

Do you have any suggestions?

question

Thread Thread
 
maoberlehner profile image
Markus Oberlehner

Passing props to <router-view> is fine in my opinion!

Thread Thread
 
tiagosmartinho profile image
Tiago Martinho

ty :p

a problem occured. On some pages, the props data is expected to be an object, but on others it is an array.

I thought I'd give the property multiple types, or is there a better solution?

Solution

props: {
    data: Object | Array
},
Thread Thread
 
maoberlehner profile image
Markus Oberlehner

LGTM ;)