Skip to content

Instantly share code, notes, and snippets.

@longseespace
Created January 13, 2022 08:16
Show Gist options
  • Select an option

  • Save longseespace/f5ab22f9264d3d40b05e722c12eb5b67 to your computer and use it in GitHub Desktop.

Select an option

Save longseespace/f5ab22f9264d3d40b05e722c12eb5b67 to your computer and use it in GitHub Desktop.

Revisions

  1. longseespace created this gist Jan 13, 2022.
    7 changes: 7 additions & 0 deletions SignInForm.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    import { useMountDebug } from './useMountDebug';

    function SignInForm(props) {
    useMountDebug('SignInForm');

    return (<div></div>)
    }
    10 changes: 10 additions & 0 deletions useMountDebug.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    import { useEffect } from 'react';

    export function useMountDebug(label = 'Component') {
    useEffect(() => {
    console.log(label, 'mounted');
    return () => {
    console.log(label, 'unmounted');
    };
    }, []);
    }