0.1.1 • Published 4 years ago
@app-elements/use-mount v0.1.1
useDocumentClick
A (P)React hook that calls a function after the component is mounted, and possibly when unmounted.
Installation
npm install --save @app-elements/use-mount
Usage
import { useMount } from '@app-elements/use-mount'
const MyComponent = () => {
useMount(() => alert('MOUNTED'), /* () => alert('UNMOUNTED') */)
return null
}
Props
Prop | Type | Default | Description |
---|---|---|---|
onMount | Function | None | Function to invoke on component mount |
onUnmount | Function | None | Function to invoke on component unmount |
0.1.1
4 years ago