0Pricing
Sveltejs Academy · Lesson

Passing Props from Parent

Provide values to child component props in the parent template.

Import the Child

Use a standard ES import at the top of the parent to bring in the child component.

<script>
  import Greeting from "./Greeting.svelte";
</script>

Use the Tag

Render the child by writing a tag with its capitalized name.

<Greeting />

All lessons in this course

  1. Declaring Props with export let
  2. Passing Props from Parent
  3. Default Prop Values
  4. Forwarding Props with $$props and $$restProps
← Back to Sveltejs Academy