onMount
Runs after a successful native mount; cleaned up and re-run on accepted refresh.
Usage
Start and stop a timer
import { Text, onMount, signal } from 'kuito';
export function ElapsedTime() {
const seconds = signal(0);
onMount(() => {
const timer = setInterval(() => seconds.value++, 1000);
return () => clearInterval(timer);
});
return <Text>{`${seconds.value} seconds on this screen`}</Text>;
}Signatures
(fn: () => void | (() => void), name?: string): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
fn | () => void | (() => void) | Yes | — |
name | string | No | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.