Skip to content

Latest commit

Β 

History

History
31 lines (22 loc) Β· 467 Bytes

useLogger.md

File metadata and controls

31 lines (22 loc) Β· 467 Bytes

useLogger

React lifecycle hook that console logs parameters as component transitions through lifecycles.

Usage

import {useLogger} from 'react-use';

const Demo = (props) => {
  useLogger('Demo', props);
  return null;
};

Example Output

Demo mounted {}
Demo updated {}
Demo unmounted

Reference

useLogger(componentName: string, ...rest);
  • componentName β€” component name.
  • ...rest β€” parameters to log.