Recall & Review
beginner
What are props in Svelte?
Props are custom attributes passed from a parent component to a child component to share data.
Click to reveal answer
beginner
Why do we pass data to children using props?
Passing data with props lets child components receive information from parents, making components reusable and dynamic.
Click to reveal answer
intermediate
How does passing props help in component reusability?
Props allow the same child component to show different data depending on what the parent sends, so you don’t rewrite code.
Click to reveal answer
intermediate
What happens if a child component does not receive a prop it expects?
The child may show default values or errors because it lacks the data needed to display or behave correctly.
Click to reveal answer
intermediate
Can child components change props directly in Svelte?
No, props are read-only inside children. To change data, children must send events or use stores to update the parent.
Click to reveal answer
What is the main purpose of props in Svelte?
✗ Incorrect
Props are used to send data from a parent component to its child components.
If a child component needs to update data received via props, what should it do?
✗ Incorrect
Props are read-only in children; children notify parents to update data via events.
Which of these is NOT a benefit of passing props to children?
✗ Incorrect
Props only pass data from parent to child, not the other way around.
What happens if a parent does not pass a required prop to a child?
✗ Incorrect
Children may use default values or fail if required props are missing.
In Svelte, how do you declare a prop in a child component?
✗ Incorrect
Props are declared by exporting variables inside the