useRenderInfo

Log render information for debugging.

https://www.shaktools.com/shak-hooks
Utility

API Reference

Installation

terminal
pnpm add @shak-hooks/usehooks
import.ts
import { useRenderInfo } from "@shak-hooks/usehooks";
Source: packages/react/src/useRenderInfo.ts

Signature

signature.ts
export function useRenderInfo(name: string = 'Component')

Parameters

NameTypeOptionalDefault
namestringYes'Component'

Returns

unknown

Implementation

use-render-info.ts
1import { useEffect, useRef } from "react";
2
3export function useRenderInfo(name: string = "Component") {
4 const count = useRef(0);
5 const lastRender = useRef(Date.now());
6
7 useEffect(() => {
8 const now = Date.now();
9 count.current++;
10
11 console.log(`${name} rendered ${count.current} times`);
12 console.log(`Time since last render: ${now - lastRender.current}ms`);
13
14 lastRender.current = now;
15 });
16}

Advertisement

Google Ads

Usage

example.tsx
1import { useRenderInfo } from "@shak-hooks/usehooks";
2
3const result = useRenderInfo(undefined);
4// result: unknown
5// Use values directly (React state).

Let‘s do great work together

Empowering creators with free, high-performance AI, SEO, and developer tools. Join thousands of users optimizing their workflow with Shak-Tools.

Tools10+ Free
UsersGlobal

Stay in the loop

Join our newsletter for the latest AI tools and updates.

ShakTools
© 2025 Shaktools. All Rights Reserved.Privacy Policy