Forwarding Events with on:click
Re-emit component events to the parent using the bare on: directive.
Event Forwarding
To re-emit a child element's event up through your component, write on:event with no handler.
Basic Forwarding
This forwards the inner button's click to the consumer of MyButton.
<button on:click>Click</button>All lessons in this course
- on:click on:input on:submit
- Event Modifiers: preventDefault stopPropagation once
- Custom Events with createEventDispatcher
- Forwarding Events with on:click