Complete the code to import the event dispatcher from Svelte.
import { [1] } from 'svelte';
The createEventDispatcher function is imported from Svelte to create custom events.
Complete the code to create the dispatcher inside the component.
const [1] = createEventDispatcher();The variable dispatch is commonly used to hold the dispatcher returned by createEventDispatcher().
Fix the error in the code to dispatch a 'save' event with data.
dispatch('[1]', { id: 1, name: 'Test' });
The event name should be a simple string like 'save' to identify the event.
Fill both blanks to dispatch a 'change' event with a value and listen to it in the parent.
<ChildComponent on:[1]={ [2] } />
The child dispatches a 'change' event, and the parent listens with on:change calling handleChange.
Fill all three blanks to create a dispatcher, dispatch a 'submit' event with form data, and listen in the parent.
<script> const [1] = createEventDispatcher(); function submitForm() { [1]('[2]', { user: 'Alice' }); } </script> <!-- Parent usage: <ChildComponent on:[2]={handleSubmit} /> -->
Use dispatch to create the dispatcher, dispatch the 'submit' event, and listen with on:submit in the parent.