Svelte · Middle · Question 59 of 75
How do you give a $bindable prop a fallback value?
let { open = $bindable(false) } = $props();- ✓Correct answer: Pass the fallback to
$bindable(...); it is used when the parent doesn't provide the prop - 2Use
open ??= falseafter destructuring - 3Bindable props can't have defaults
Explanation
If the parent does bind it, the component writes changes back to the parent's state.