Forwarding Props with $$props and $$restProps
Pass all or remaining props through to an inner element or component.
Why Forward Props
Wrapper components often need to pass all received props to an inner element. Forwarding avoids listing every attribute.
The $$props Object
Inside a component, $$props is an object containing every prop passed to the component.
<script>
// $$props is auto-injected
</script>
<input {...$$props} />All lessons in this course
- Declaring Props with export let
- Passing Props from Parent
- Default Prop Values
- Forwarding Props with $$props and $$restProps