You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/site/content/tutorial/03-props/03-spread-props/text.md

11 lines
460 B

---
title: Spread props
---
If you have an object of properties, you can 'spread' them on to a component instead of specifying each one:
```html
<Info {...pkg}/>
```
> Conversely, if you need to reference all the props that were passed into a component, including ones that weren't declared with `export`, you can do so by accessing `$$props` directly. It's not generally recommended, as it's difficult for Svelte to optimise, but it's useful in rare cases.