Declaring Props with export let
Expose component properties to parent components using the export keyword.
Props Are Exports
To declare a prop, write export let name in the component script. The keyword export exposes it to parents.
<script>
export let name;
</script>
<p>Hello {name}!</p>Multiple Props
List as many props as your component needs.
<script>
export let title;
export let count;
export let onClick;
</script>All lessons in this course
- Declaring Props with export let
- Passing Props from Parent
- Default Prop Values
- Forwarding Props with $$props and $$restProps