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

react-smart-memo-z

v1.0.0

Published

Smart memoization utilities for React. Prevent unnecessary re-renders by tracking actual prop usage, with selector-based and auto-tracking support.

Readme

✨ react-smart-memo-z

NPM Downloads

Smart memoization utilities for React that prevent unnecessary re-renders by tracking which props are actually used during render.


🌟 Why react-smart-memo-z?

React.memo compares all props by reference.
react-smart-memo-z compares only the props you actually read.

✔ Faster renders
✔ Zero config
✔ Works with nested objects
✔ Debuggable render reasons


📦 Installation

npm install react-smart-memo-z

# yarn add react-smart-memo-z

🚀 Usage

smartMemo (HOC)
import { smartMemo } from 'react-smart-memo-z'

type User = {
  name: string
  age: number
}

const UserCard = smartMemo(
  ({ user }: { user: User }) => {
    console.log('render')
    return <div>{user.name}</div>
  },
  { debug: true, name: 'UserCard' }
)

<UserCard user={{ name: 'A', age: 20 }} />
<UserCard user={{ name: 'A', age: 21 }} />

// ❌ no re-render (age not used)

useSmartMemo (Hook)
import { useSmartMemo } from 'react-smart-memo-z'

function Profile({ user }: { user: any }) {
  const smartUser = useSmartMemo(user)
  return <div>{smartUser.name}</div>
}

🧠 How it works

  1. Wraps props with Proxy
  2. Tracks accessed paths (user.name, settings.theme, …)
  3. On next render, compares only used paths
  4. Skip render if nothing changed

🐞 Debug Mode

smartMemo(Component, {
  debug: true,
  name: 'MyComponent'
})

Console output:

[SmartMemo] MyComponent re-render because: ['user.name']

🧪 When should you use it?

✅ Large objects as props
✅ Lists with frequent updates
✅ Performance-critical UI
✅ Auto-tracking mainly for dev/debug ✅ Use selector-mode for production ❌ Simple components (React.memo is enough)


📁 API

smartMemo(Component, options?)

| Option | Type | Description | |--------|----------|-------------------------| | debug | boolean | Log re-render reasons | | name | string | Component name in logs | | select | function | Custom selector compare |


📜 License

MIT