useLoggerReact lifecycle hook that console logs parameters as component transitions through lifecycles.
import {useLogger} from 'react-use';
const Demo = (props) => {
useLogger('Demo', props);
return null;
};
Demo mounted {}
Demo updated {}
Demo unmounted
useLogger(componentName: string, ...rest);
componentName — component name....rest — parameters to log.// TODO: implement useLogger function notImplemented(..._args: any[]): any { throw new Error('Not implemented'); } export default notImplemented; export const useLogger = notImplemented;
Tests