npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@devloom/react-performance

v0.1.1

Published

Lightweight React hooks to debug and understand re-renders

Readme

devloom-react-performance

Lightweight, production-safe React hooks to understand, debug, and control re-renders — without blind optimization.


🚩 The Real Problem

Most React performance issues are not caused by slow code.

They are caused by:

  • Unexpected re-renders
  • Unstable props and callbacks
  • Overuse of useMemo / useCallback without evidence
  • Debugging performance after users complain

Teams often ask:

“Why is this component re-rendering again?”

And the honest answer is usually:

“We don’t know.”


🎯 Why this package exists

React gives us powerful tools, but limited visibility at code level.

  • React DevTools Profiler is powerful but manual and visual
  • Heavy libraries like why-did-you-render are intrusive and complex
  • Blog snippets are inconsistent and unmaintained

devloom-react-performance fills the gap:

Small, composable hooks that make React performance observable inside your code, where decisions are made.


🧠 Philosophy

This package is built on three principles:

  1. Measure before optimizing
  2. Make re-renders explicit
  3. Keep performance tools lightweight and opt-in

This is not a magic performance fix.
It is a diagnostic and learning toolkit.


📦 Installation

npm install devloom-react-performance

Peer dependency:

  • React >=16.8 (hooks support)

You can also use yarn or pnpm:

yarn add @devloom/react-performance
pnpm add @devloom/react-performance

⚡ Quick start

Import the hooks you need from the package and use them directly in your components:

import React from 'react';
import {
  useRenderCount,
  useWhyDidYouUpdate,
  useStableCallback,
  useDeepCompareEffect,
} from '@devloom/react-performance';

function UserCard(props: { name: string; isActive: boolean }) {
  const renders = useRenderCount();

  useWhyDidYouUpdate('UserCard', props);

  const onClick = useStableCallback(() => {
    console.log('clicked', props.name);
  });

  useDeepCompareEffect(() => {
    // runs only when complex dependencies deeply change
  }, [props]);

  return (
    <div>
      <div>{props.name}</div>
      <div>renders: {renders}</div>
      <button onClick={onClick}>Click</button>
    </div>
  );
}
  • React >=16.8 (hooks support)

🔧 Available Hooks

1️⃣ useRenderCount

Track how many times a component renders.

const renderCount = useRenderCount();
console.log(renderCount);

Why it matters

  • Verifies whether React.memo is working
  • Detects unnecessary re-renders early
  • Helps validate refactors

2️⃣ useWhyDidYouUpdate

Logs exactly which props changed and caused a re-render.

useWhyDidYouUpdate('UserCard', props);

Example output:

[devloom] UserCard re-rendered due to:
{ isActive: [false, true], theme: ['light', 'dark'] }

🔒 Dev-only: Logs automatically disabled in production.


3️⃣ useStableCallback

Provides a stable function reference without dependency-array complexity.

const onClick = useStableCallback(() => {
  submitForm();
});

Why it matters

  • Prevents unnecessary child re-renders
  • Avoids overuse of useCallback
  • Keeps logic fresh while reference stays stable

4️⃣ useDeepCompareEffect

Runs an effect only when dependencies deeply change.

useDeepCompareEffect(() => {
  fetchData(filters);
}, [filters]);

🧪 Production Safety

  • No React patching
  • No global side effects
  • No runtime cost in production for logging hooks
  • Hooks are opt-in and local to components

🧭 When should you use this?

  • Debugging unnecessary re-renders
  • Verifying memoization effectiveness
  • Refactoring performance-sensitive components
  • Teaching performance concepts to teams

🚫 What this package is NOT

  • Not a replacement for React DevTools
  • Not a performance silver bullet
  • Not a profiling framework

📜 License

MIT


Juniors optimize by habit.
Seniors optimize by measurement.