mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
34 lines
431 B
Markdown
34 lines
431 B
Markdown
# `useLogger`
|
|
|
|
React lifecycle hook that logs in console as component transitions through life-cycles.
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useLogger} from 'react-use';
|
|
|
|
const Demo = (props) => {
|
|
useLogger('Demo', props);
|
|
return null;
|
|
};
|
|
```
|
|
|
|
|
|
## Example Output
|
|
|
|
```
|
|
Demo mounted
|
|
Demo props updated {}
|
|
Demo un-mounted
|
|
```
|
|
|
|
|
|
## Reference
|
|
|
|
```js
|
|
useLogger(name, props);
|
|
```
|
|
|
|
- `name` — component name.
|
|
- `props` — latest props.
|