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-fast-context-z

v1.1.3

Published

A tiny external store with fine-grained subscriptions. Provider-less, selector-based, built for React 18+.

Downloads

992

Readme

⚡ react-fast-context-z

NPM Downloads

LIVE EXAMPLE


Ultra-lightweight, selector-based state container for React. No Provider. No reducer. No proxy. No magic.

Designed to stay boring, explicit, and fast

Read and update state with the least possible runtime overhead.


Why react-fast-context-z?

  • ⚡ Fast re-renders via fine-grained selectors
  • ✍️ Explicit, imperative state mutation
  • 🚫 No Provider / no Context tree
  • 🧠 Framework-agnostic core (works outside React)
  • 🔌 Clean integration with external logic / intent engines
  • 📦 Tiny bundle, minimal runtime

Mental Model

intent / action
      ↓
 explicit mutation
      ↓
   state store
      ↓
 selector subscription
      ↓
 React re-render

No reducers.
No dependency graph.
No proxy tracking.

What you write is exactly what runs.


Installation

npm install react-fast-context-z

Basic Usage

import { createFastContext } from "react-fast-context-z"

const counter = createFastContext({
  state: { count: 0, loading: false },
  actions: {
    inc(s) {
      s.loading = true
      s.count++
      s.loading = false
    },
    add(s, n: number) {
      s.count += n
    },
  },
})

const double = counter.computed(s => s.count * 2)

export function Fast() {
  const count = counter.use(s => s.count)

  return (
    <>
      <div>{double.use()}</div>
      <button onClick={() => counter.actions.inc()}>
        {count}
      </button>
    </>
  )
}

Selectors & Derived State

Selectors subscribe only to what they read.

const double = counter.computed(s => s.count * 2)

function View() {
  const value = double.use()
  return <div>{value}</div>
}
  • No re-render if selector output doesn’t change
  • Derived selectors are memoized and reactive

Merge Mode

react-fast-context-z supports configurable merge strategies when updating state.

const store = createFastContext({
  state: { user: { name: "A", age: 20 } },
  merge: "shallow",
})

Available modes

merge: "shallow" (default)

  • Shallow-merge object fields
  • Mutated fields are preserved
  • Ideal for mutable, intent-driven updates
set(s => {
  s.user.name = "B"
})
// keeps user.age

merge: "replace"

  • Replace state reference entirely
  • Useful when state is treated as immutable snapshots
set(() => ({
  user: { name: "B", age: 30 }
}))

When to use which?

| Mode | Use case | |------------|------------------------------------------------| | shallow | Explicit mutation, intent/actions, local state | | replace | Immutable data, server snapshots, undo/redo |

The merge mode is explicit — no hidden heuristics.


Batch & Transaction

Batch updates (single notify)

counter.batch(() => {
  counter.actions.inc()
  counter.actions.add(10)
})

Rollback-safe transaction

try {
  counter.transaction(() => {
    counter.actions.add(100)
    throw new Error("cancel")
  })
} catch {}

State is restored automatically if an error is thrown.


IntentX Integration

import { createIntentBus } from "intentx-core-z"
import { bindFastContext } from "react-fast-context-z"

const context = bindFastContext(counter)
const bus = createIntentBus(context)

bus.on("increment", ({ setState }) => {
  setState(s => {
    s.count++
  })
})

Designed to work cleanly with intent-first architectures.


Comparison

| Feature / Library | React Context | Redux | Zustand | Jotai | react-fast-context-z | | ---------------------------------- | ------------- | ----- | ------- | ----- | -------------------- | | Provider required | ⚠️ | ❌ | ❌ | ❌ | ❌ | | Selector-based render | ❌ | ✅ | ✅ | ✅ | ✅ | | Fine-grained updates | ❌ | ⚠️ | ⚠️ | ✅ | ✅ | | Proxy / atom graph | ❌ | ❌ | ❌ | ✅ | ❌ | | Reducers required | ❌ | ✅ | ❌ | ❌ | ❌ | | Direct mutation API | ❌ | ❌ | ⚠️² | ❌ | ✅ | | Works outside React | ❌ | ⚠️³ | ⚠️³ | ❌ | ✅ | | Intent / event-driven friendly | ❌ | ❌ | ⚠️ | ❌ | ✅ | | Async flow native | ❌ | ⚠️ | ❌ | ❌ | ✅ | | Devtools ecosystem | ❌ | ✅ | ⚠️ | ⚠️ | ❌ (by design) | | Bundle size | tiny | large | small | small | tiny |


Philosophy

  • State should be boring
  • Logic should be explicit
  • Rendering should be fast

If you:

  • already have a logic layer
  • want full control over mutations
  • hate hidden magic

Then this library is for you.


License

MIT