# useRenderCount Tracks and logs the number of times a component has rendered. This hook is helpful for debugging performance optimizations or identifying unnecessary renders. ## Usage ```tsx import { useRenderCount } from '@gilbarbara/hooks'; function Component() { useRenderCount(); return (
Something
); } ``` **Debugging a component’s render behavior** ```tsx import { useRenderCount } from '@gilbarbara/hooks'; function DebugComponent() { const count = useRenderCount('DebugComponent'); return (

This component has rendered {count} times.

); } ``` **Comparing render counts in Parent and Child components** ```tsx import { useRenderCount } from '@gilbarbara/hooks'; function Parent() { useRenderCount('Parent'); return (

Parent Component

); } function Child() { const count = useRenderCount('Child'); return

Child has rendered {count} times.

; } ``` ## Reference ```typescript useRenderCount(name?: string): number; ```