|
Download react-use/docs/useRendersCount.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 522 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/docs/useRendersCount.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-use/docs/useRendersCount.md
-
curl -L -o useRendersCount.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/docs/useRendersCount.md
522 Bytes
| # `useRendersCount` | |
| Tracks component's renders count including the first render. | |
| ## Usage | |
| ```typescript jsx | |
| import * as React from 'react'; | |
| import { useRendersCount } from "react-use"; | |
| const Demo = () => { | |
| const update = useUpdate(); | |
| const rendersCount = useRendersCount(); | |
| return ( | |
| <div> | |
| <span>Renders count: {rendersCount}</span> | |
| <br /> | |
| <button onClick={update}>re-render</button> | |
| </div> | |
| ); | |
| }; | |
| ``` | |
| ## Reference | |
| ```typescript | |
| const rendersCount: number = useRendersCount(); | |
| ``` | |