Svelte · Middle · Question 10 of 75

What does $props() give you besides named props?

let { variant = "primary", children, ...rest } = $props();

Explanation

This replaces $$props and $$restProps from Svelte 4. Event handlers like onclick are just props too.

Further reading

Problem with a question

Svelte · Middle · question 10

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz