react-functional-mount
v1.0.2
Published
Mount/Unmount hook for functional component
Downloads
18
Readme
react-functional-mount
Mount/Unmount hook for functional component
Install
npm install --save react-functional-mount
Usage
import { useWillMount, useDidMount, useWillUnmount, useDidUnmount } from 'react-functional-mount'
export const Example: React.FC = () => {
useWillMount(() => {
console.log('Example', 'componentWillMount')
})
useDidMount(() => {
console.log('Example', 'componentDidMount')
})
useWillUnmount(() => {
console.log('Example', 'componentWillUnmount')
})
useDidUnmount(() => {
console.log('Example', 'componentDidUnmount')
})
return <Component />
}
License
MIT © 2sem