Let’s see what is the best way to pass data between components
When I started using Vue, I just passed data between components through the props, deepening this framework I found that I could achieve the same result with slots.
We have seen many ways of passing data between components, it depends on your needs whether to use props or slots.
With props, you can only pass values to the child component, so the parent wouldn’t be able to customize the child.
If you have a defined design and you just need to change some values, use props!
Slots give you more flexibility and allow you to customize the child component from the parent.
If you want to give the parent the freedom to customize components, use slots!
Check out all the full article with the examples on Medium 👇
The Difference Between Props, Slots and Scoped Slots in Vue.js | by Luca Spezzano | NotOnlyCSS | Medium
Luca Spezzano ・ ・ 4 min read
Medium
Ps. In the comments you will find the friends link if you have finished your monthly view on Medium. If you are not happy that the article is on Medium, nobody forces you to read it.
Peace and love ✌️❤️
Top comments (1)
If are not able to read the article, you can try this link: medium.com/notonlycss/the-differen...