DEV Community

Luca Spezzano
Luca Spezzano

Posted on


The Difference Between Props, Slots and Scoped Slots in Vue.js

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 👇

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

Oldest comments (1)

93lucasp profile image
Luca Spezzano

If are not able to read the article, you can try this link:

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!