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-pae

v0.1.2

Published

[![npm version](https://badge.fury.io/js/react-pae.svg)](https://badge.fury.io/js/react-pae)

Downloads

5

Readme

React-pae

npm version

React-pae is a very tiny util that can help you create "arePropsEqual" functions with ease.

Features

  • TypesScript support for strict type checking when comparing props
  • Very small library, but saves you code
  • Support for shallow, deep and skipping equality checks
  • BYOC (Bring Your Own Comparer). Determine for yourself how props should be compared.
  • Actually works with any (prev, next) => boolean callback
  • Combine multiple "settings".

Quick start

Installation

yarn add react-pae

or

npm i --save react-pae

Example

Imagine we have this heavy month component from which its usage is simplified in the code sample below. It probably exists in a calendar component that has a lot of interactions hypothetically.

import propsAreEqual from 'react-pae';

const Month = props => {
  return (
    <div>
      {props.date.getMonth()}
      <button onClick={props.onClick}>open month</button>
      {children}
    </div>
  );
};

export default React.memo(
  Month,
  propsAreEqual({
    // BYOC, we can create our own comparer as direct date comparisons (new Date() !== new Date()) don't work
    date: (prev, next) => +prev === +next,
    // simple callback which is always of the same shape
    onClick: 'skip',
    // an array, but shallowly [] === [] = false, that's why we check it "deeply"
    bookings: 'deep',

    // all other props are checked shallowly as you'd expect with solely using `React.memo()`
  })
);

Motivation

When using the React.memo() HOC you can determine for yourself if a component needs to be rerendered. Especially when components are heavy on the performance aspect, this can be a nice addition in order to improve the performance. However, multiple times I've found myself repeating same code over and over again. Like using deep equality for certain props and then loop over the other ones to shallow ignore them. Even enable skipping some props that shouldn't be considered.

Note that you could, and probably most of the time should, use the hooks useMemo and useCallback in order to not rerender when basically using the same object or function. See this great article by Kent C Dodds for more information on these hooks

However, sometimes you want to have a little more control and React.memo() is a great tool for that. To make its use a little bit easier this package can help you.