UNPKG

reactuals

Version:

A useful package providing a collection of 50+ React hooks and utilities to simplify React development.

14 lines (13 loc) 302 B
import { useRef } from "react"; /** * Tracks how many times a component has rendered. * * Example: * const count = useRenderCount(); * return <div>Rendered {count} times</div>; */ export function useRenderCount() { const count = useRef(1); count.current += 1; return count.current; }