useHost
Hook that creates a reference that curren is the instance of the webcomponent.
Syntax
const refHost = useHost();Example
import { useHost, useEffect } from "atomico";
function useListener(type: string, callback: (ev: Event) => void) {
const ref = useHost();
useEffect(() => {
const { current } = ref;
current.addEventListener(type, callback);
return () => current.removeEventListener(type, callback);
}, []);
}Last updated
Was this helpful?
