Skip to content

React hook to handle componentDidMount, and componentWillUnmount lifecycle events.

License

Notifications You must be signed in to change notification settings

brunoscopelliti/use-did-mount

Repository files navigation

@bscop/use-did-mount

GitHub license npm version CircleCI Status Coverage

React hook to handle componentDidMount, and componentWillUnmount lifecycle events.

Install

npm i @bscop/use-did-mount

Usage

import useDidMount from "@bscop/use-did-mount";

useDidMount(
  function onMount () {
    console.log("Yay, component is mounted");

    return function onUnmount () {
      console.log("Yay, component is unmounted");
    }
  },
);

Contribute

Read the guidelines.

Run tests

npm test

Coverage

Coverage reports are hosted on codecov.

npm run badge:coverage -- --token=<guid>

Bruno Scopelliti
www.brunoscopelliti.com

About

React hook to handle componentDidMount, and componentWillUnmount lifecycle events.

Topics

Resources

License

Stars

Watchers

Forks