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

v3.0.3

Published

A lightweight, deeply type-safe React global state manager with zero dependencies. Blazingly fast.

Readme

NPM Version ESLint Check Bundle Size GitHub license


Note: This is the documentation for v3. Upgrading from v2? Check out the v3 Migration Guide. For older docs, see README-v2.md.

🤔 What React Rhino is (and what it isn't)

We built Rhino because we were tired of boilerplate-heavy setups just to share a string or a boolean across two components.

What it IS:

  • Featherweight & Zero Dependencies: With a minified + gzipped size of just ~860 bytes, React Rhino practically disappears into your bundle. No external dependencies. Just pure React goodness.
  • Blazingly Fast: Powered by an event-driven useSyncExternalStore architecture. Components only re-render if the exact state key they are subscribed to changes. No more unnecessary re-renders. No more "Provider Hell".
  • Type-Safe by Default: Thanks to the createRhinoStore factory, you get 100% perfect type inference and autocompletion out-of-the-box. No manual interface definitions required.
  • Familiar: The syntax is identical to React's native useState. If you know React, you already know Rhino.

What it ISN'T:

  • A monolithic state machine: Rhino intentionally avoids complex middlewares, time-travel debugging, reducers, or deeply nested derived state selectors.
  • When to look elsewhere: If you are building a massive enterprise application that heavily relies on complex state middleware, intricate data transformations, or devtools integrations, you should consider sophisticated options like Zustand, Redux Toolkit, or Jotai.

Rhino is for the indie hacker, the clean-code enthusiast, and the pragmatic developer who wants simple, decoupled global state that just works.


📦 Installation

# npm
npm install react-rhino

# yarn
yarn add react-rhino

# pnpm
pnpm add react-rhino

🚀 Quick Start

Use the createRhinoStore factory function to generate strongly-typed providers and hooks tailored precisely to your store.

Step 1: Define your store

Create a central file for your state (e.g., store.ts). Just define a plain object.

import createRhinoStore from 'react-rhino';

const store = {
  darkMode: true,
  userName: "John Doe",
  count: 0
};

// createRhinoStore automatically infers all keys and types from your store object!
export const { 
  RhinoProvider, 
  useRhinoState, 
  useRhinoValue, 
  useSetRhinoState 
} = createRhinoStore(store);

Step 2: Wrap your App

Wrap your application (or a part of it) with the generated RhinoProvider.

import { RhinoProvider } from './store';
import Counter from './Counter';
import Header from './Header';

function App() {
  return (
    <RhinoProvider>
      <Header />
      <Counter />
    </RhinoProvider>
  );
}

export default App;

Step 3: Consume State Anywhere

Use your generated hooks anywhere inside the provider. Enjoy the magical TypeScript autocompletion!

import { useRhinoState, useSetRhinoState } from './store';

const Counter = () => {
  // Full autocompletion for "count", and perfect type inference for `setCount`!
  const [count, setCount] = useRhinoState("count"); 

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(prev => prev + 1)}>Increment</button>
    </div>
  );
}

export const Header = () => {
  // Only updates the state. Doesn't read it.
  // This component will NEVER re-render when "count" changes! ⚡
  const setCount = useSetRhinoState("count");

  return <button onClick={() => setCount(0)}>Reset Counter</button>;
}

📖 Hooks API Overview

useRhinoState(key)

Returns a tuple with the current state value and a setter function, identical to useState.

useRhinoValue(key)

Returns only the state value. Use this if your component only needs to read the state but performs no updates.

useSetRhinoState(key)

Returns only the setter function. Pro-tip: Use this if your component only updates the state without reading it. It guarantees the component will not re-render when the state changes!


🎮 Example App

Want to see it in action? Check out the example app in the example directory.

cd example
npm install
npm run dev