Event declaration
Host to declare events
import { Host, c, useEvent } from "atomico";
function myComponent(): Host<{
onMyCustomEvent: Event
}> {
const dispatch = useEvent("MyCustomEvent");
return <host>
<button onclick={dispatch}>click</button>
</host>;
}
export const MyComponent = c(myComponent);import { MyComponent } from "my-componnet";
<MyComponent
onMyCustomEvent={(event) => {
event.currentTarget; // < MyComponent
}}
></MyComponent>;Last updated
Was this helpful?
