Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 425 Bytes

useLogger.md

File metadata and controls

33 lines (22 loc) · 425 Bytes

useLogger

React生命周期钩子,在生命周期中作为组件转换记录到控制台。

用法

import {useLogger} from 'react-use';

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

Example Output

Demo mounted
Demo props updated {}
Demo un-mounted

参考

useLogger(name, props);
  • name — component name.
  • props — latest props.