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

react-changes

v0.2.0

Published

React-Changes is a versatile and easy-to-use state management library built for React applications. It simplifies the state management process by providing a `useChange` hook, a powerful custom hook for interacting with the global state. This hook can be

Readme

React-Changes

React-Changes is a versatile and easy-to-use state management library built for React applications. It simplifies the state management process by providing a useChange hook, a powerful custom hook for interacting with the global state. This hook can be used in a named or unnamed manner, and the library also provides versioning and playback capabilities for your global state changes.

Features

  • useChange Hook: This is a custom React hook that behaves like the built-in useState hook. It can be used in a named or unnamed manner. In both cases, it returns a pair, an array with the current state value and a function to update that value.

  • Nested State Access: The named usage of useChange is particularly useful for accessing nested state properties. It's ideal for managing multi-page forms, more complicated data sets, or grouping related properties together.

  • Versioning: Every change to the global state is stored as a unique version, making it possible to undo and redo changes, view the history of changes, or seek to a specific version.

  • Playback: You can export the user's entire experience and reload it for playback. This feature is beneficial for running exact tests during QA (Quality Acceptance) or for quality assurance purposes.

Installation

Use npm or yarn to install the package.

npm install react-changes
yarn add react-changes

Usage

First, wrap your application in the Changes (GlobalStateProvider) component.

import { Changes } from "react-changes";

function App() {
  return (
    <Changes>
      <YourComponent />
    </Changes>
  );
}

Named usage

When you want to assign a specific name (path) to your state value, you can use the useChange hook as follows:

import { useChange } from "react-changes";

function YourComponent() {
  const [value, setValue] = useChange("some.path", "default value");

  // To update the value
  setValue("new value");

  // ...
}

The named usage of useChange is particularly useful for accessing nested state properties. For example, you can use it to manage multi-page forms or group related properties together.

Unnamed usage

To access a global state without providing a name (path), you can use the useChange hook as follows:

import { useChange } from "react-changes";

function YourComponent() {
  const [value, setValue] = useChange("default value");

  // To update the value
  setValue("new value");

  // ...
}

In this case, the hook automatically assigns a unique, memoized string as the path to your state value.

To access the control actions for the global state, use the useChangeControls hook.

import { useChangeControls } from "react-changes";

function YourComponent() {
  const { undo, redo, play, stop, clear, versions, seek } = useChangeControls();

  // ...
}

To display buttons for controlling the global state, use the PlayerControls component.

import { PlayerControls } from "react-changes";

function YourComponent() {
  // ...
  return (
    <div>
      {/* Your component code... */}
      <PlayerControls />
    </div>
  );
}

Debugging

For debugging, you can enable the debug prop in the Changes (GlobalStateProvider) component. This will expose the global state context to the window object.

<Changes debug>
  {/* Your components */}
</