React生命周期钩子,在生命周期中作为组件转换记录到控制台。
import {useLogger} from 'react-use';
const Demo = (props) => {
useLogger('Demo', props);
return null;
};
Demo mounted
Demo props updated {}
Demo un-mounted
useLogger(name, props);
name
— component name.props
— latest props.