Vue Slots in 8 Minutes or Less

Hi! I'm Cass.

1. What are slots?
2. When should I use them?

Vue Slots

Another way to give components a parent-child relationship

Named Slots

Provide unique names so that multiple slots can get their own stuff

Fallback Content

Default stuff to show in case nothing is passed to the slot.

Why?

A couple of benefits of using slots: 

- Can pass arbitrary content to child components

- Passing components to children is a breeze

- We can have even less logic in our children

- Can make code more reusable

- Looks kinda nice

To see an example of a project with slots vs the same project with props, check out this repo: https://github.com/CassandraGoose/props-vs-slots

1. What are slots?

 - Another way to create child/parent relationships between components.
2. When should I use them?

- When it can make your components more reusable and versatile.

Vue Slots in 8 Minutes or Less

By Cassandra Torske

Vue Slots in 8 Minutes or Less

  • 48