DEV Community

loading...

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

Collapse
maoberlehner profile image
Markus Oberlehner

You might be interested in my article about this very same topic (funnily enough also inspired by the same podcast episode): Building Renderless Components to Handle CRUD Operations in Vue.js

Collapse
sammerro profile image
Michał Kowalski

I read your article several months ago. Great content. I even sent the link to my coworkers! Although I was affraid to introduce it to our code.
Now I have found another post and started to think about it more seriously.
But probably I will use it in a new project.

Collapse
lhermann profile image
Lukas Hermann Author

This is awesome and a really smart solution! Have you tried this with server-side form validation?

Thread Thread
maoberlehner profile image
Markus Oberlehner

Thanks! No, haven't used this extensively myself yet.

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