Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

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