Skip to content

Function: useMount()

useMount(onMount?, onUnmount?): void

Defined in: hooks/useMount.ts:14

Simple React hook to trigger callback when component mounts and/or unmounts

Parameters

onMount?

UseMountCb | null

(optional) Callback invoked whenever component mounts.

onUnmount?

boolean | UseMountCb | null

(optional) Callback invoked whenever component unmounts. If true and onMount is provided, onMount will be invoked on both mount and unmount events.

Returns

void