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 🙏

© 2025 – Pkg Stats / Ryan Hefner

render-peek

v1.0.1

Published

A lightweight React Hook for visually detecting unnecessary re-renders

Readme

render-peek 🫣

Stop guessing. Start seeing. A lightweight React Hook that visually exposes unnecessary re-renders in real-time.

npm version License: MIT

Why render-peek?

React performance issues are often invisible. Components re-render silently, eating up CPU cycles and draining battery, often due to:

  • ❌ New object references passed as props (e.g., style={{}} or inline functions).
  • ❌ Parent updates that shouldn't affect the child.
  • ❌ Broken React.memo comparisons.

Console logs are noisy. React DevTools is powerful but heavy.

render-peek gives you immediate, visual feedback right in your UI. If a component re-renders but its props haven't actually changed (deep equality), it flashes orange.

It's like a Geiger counter for wasted renders.

Features

  • 🔦 Visual Feedback: A subtle orange flash on unnecessary re-renders.
  • 🧠 Smart Comparison: Uses deep equality to detect when props are technically new but semantically identical.
  • 🙈 Ignore Noise: Easily ignore unstable props (like inline callbacks) that trigger false positives.
  • 🪶 Zero Config: Just import and use. Styles are injected automatically.
  • 📦 Tiny: < 2kb gzipped.

Installation

npm install render-peek
# or
yarn add render-peek
# or
pnpm add render-peek

Usage

1. Basic Usage

Wrap your component's props with useRenderPeek. If the component re-renders but props are unchanged, it will flash.

import { useRenderPeek } from 'render-peek';

export const UserCard = (props) => {
  // 1. Hook into the render cycle
  const { className } = useRenderPeek(props);

  return (
    // 2. Apply the class to your root element
    <div className={`card ${className}`}>
      <h2>{props.name}</h2>
    </div>
  );
};

2. Ignoring Unstable Props (Common Scenario)

Often you pass inline functions (callbacks) that are recreated on every render. These are changes, but you might not care about them for performance tuning. Use ignoreKeys to skip them.

// Parent passes a new arrow function every time:
// <Button onClick={() => handleClick()} />

export const Button = (props) => {
  const { className } = useRenderPeek(props, {
    // Ignore 'onClick' so it doesn't trigger a "valid" change detection
    ignoreKeys: ['onClick'] 
  });

  // Now, if 'onClick' changes but other props are stable, 
  // render-peek will see it as an "unnecessary" render and FLASH.
  
  return <button className={className} {...props} />;
};

How to Interpret the Flash

  • No Flash:
    • Either the component didn't render (good!).
    • Or it rendered because props actually changed (good!).
  • 🟠 Orange Flash:
    • The component rendered, BUT the props (excluding ignored ones) are deeply equal to the previous render.
    • Action: This is a candidate for React.memo, useMemo, or fixing the parent's prop passing.

Production Usage 🛡️

render-peek is designed as a development tool. You typically shouldn't ship it to production users.

To safely leave it in your codebase without affecting production, create a wrapper hook:

// hooks/useRenderPeek.ts
import { useRenderPeek as useOriginalPeek } from 'render-peek';

export const useRenderPeek = (props: any, options?: any) => {
  // In production, return an empty object so it does nothing
  if (process.env.NODE_ENV === 'production') {
    return { className: '' };
  }
  
  return useOriginalPeek(props, options);
};

Now you can use your custom useRenderPeek everywhere. It will work in dev and be silent in prod.

License

MIT