onMount()
Register a callback that runs after the component is inserted into the DOM.
Signature
Section titled “Signature”function onMount(fn: () => void | (() => void)): voidParameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
fn | () => void | (() => void) | Mount callback. Can return a cleanup function. |
Examples
Section titled “Examples”import { component, onMount, div } from "@whisq/core";
const App = component(() => { onMount(() => { console.log("mounted!"); return () => console.log("cleanup!"); });
return div("Hello");});