October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

From Flux Store to React Adapter: How I Built a State Manager

Georg’s nexus-state grew from a simple store with subscribers into a closure-based library with a separate React adapter. Here’s how each design step solves a specific state-management problem.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Georg’s path to building nexus-state starts with a straightforward problem: when multiple React components need the same data, local state creates separate copies, while lifting state up can make prop flow and updates harder to manage as an application grows. His solution develops from a small store with subscribers into a closure-based library, then adds React integration as a separate layer.

Why build a shared store?

Georg came to React from UI/UX design and found that coordinating the same data across components quickly became cumbersome. Separate useState calls do not automatically share updates. Lifting state into a common parent can make it shared, but then the parent must pass values and update functions down through props.

As an Amazon Associate I earn from qualifying purchases.

The design goal was a shared place to read and update data, plus a way to notify only the parts of the interface that care when that data changes. As Georg puts it, “When I set out to write the library, what I wanted above all was to understand how state managers work.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start with state and subscribers

A Flux-style store

The first version follows a publisher-subscriber pattern. A store owns state and exposes two basic operations: getState returns the current value, and subscribe registers a listener. When the store changes, it notifies listeners.

A React hook can bridge that store to a component: it subscribes, keeps a React state value for rendering, and updates that value when the store sends a notification. This separates the underlying shared state from each component’s local rendering mechanism.

Use a dispatcher for known actions

The next iteration adds a dispatcher. Rather than allowing callers to write arbitrary partial state, the store accepts known action types and handles them centrally. Recognized actions change state and trigger subscriber notifications. This makes the set of supported updates more explicit, though it also introduces action registration and a switch-like dispatch path.

Keep Context stable and subscribe to changes

Georg’s concern with putting changing state directly in React Context is that consumers can rerender when the provider’s value changes, including consumers that only need one field. The alternative is to put a stable store interface in Context and let each consumer subscribe to the changing state it needs.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The article demonstrates this integration with useSyncExternalStore. Context provides access to the store; the subscription supplies the changing snapshot. That distinction matters: Context is used to distribute the store, rather than to broadcast every state update as a new context value.

Move ownership into a factory closure

A provider-based experiment exposed a lifetime problem. If state is reassigned from props or recreated while a component renders, it does not reliably persist from one render to the next. Georg first uses a ref to hold it, then moves the responsibility out of the component and into a factory.

In the final core design, a createNexus-style factory closes over the state and subscribers, then returns a stable store API. Creating another store by calling the factory again gives that store its own independent state and listeners. The closure therefore defines the lifetime and isolation boundary without requiring React.

Actions close over store operations

Actions are user-defined functions created with access to the store’s get and set operations. This lets an action read and update state directly, instead of routing every change through a separately registered string action and dispatcher. The trade-off is less centralized action-type routing in exchange for keeping related update logic close to the store factory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Features address specific coordination needs

Per-key subscriptions

Listeners can be organized by state key. When a key changes, the store can notify the subscribers for that key instead of asking every selector to reevaluate against the whole state. This reduces unnecessary selector work in the larger workloads shown in the article, but keeping key-level subscriber bookkeeping has a cost of its own.

Batching nested actions

The implementation tracks action nesting depth and keys awaiting notification. Several writes made within an action can then be collected into one notification pass, rather than notifying after every individual write.

Update-source metadata and persistence

Updates can carry provenance, such as server or storage. Subscribers and middleware can inspect that context. The persistence feature uses it to distinguish a storage restoration write from an ordinary state update: without that distinction, restoring data could trigger a persistence write back to storage and create an echo.

Middleware and developer tools

Middleware can see the previous state, next state, and update context; the described design also allows middleware to replace or cancel an update and to be removed. A subscription-based Redux DevTools adapter displays the action name, connecting the library’s updates to a familiar debugging view.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate the core from React

The core store is designed to work without React. A separate createReactNexus adapter wraps it and adds hooks such as use, useSelector, and useRerender. Keeping the adapter separate means the state and subscription model does not depend on React, while React users still get hooks tailored to component rendering.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What Georg’s performance figures show

Georg’s 2026 article compares nexus-state with zustand 5.0.15. In a React workload with 100 components spread over 50 keys and 20 single-key updates, the reported selector and render counts were:

Library Selector runs React renders
zustand 5.0.15 2,120 40
nexus-state 200 40

In that workload, per-key subscriptions reduced selector evaluations, while the number of renders was the same. The figures describe the author’s stated setup, not a general React benchmark.

The article also reports times for 20,000 updates run without React at several store sizes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Keys / components zustand 5.0.15 nexus-state
1 key / 1 component 3.5 ms 5.2 ms
3 keys / 5 components 3.4 ms 4.6 ms
5 keys / 10 components 4.6 ms 4.8 ms
10 keys / 20 components 6.3 ms 5.0 ms
50 keys / 100 components 32.3 ms 8.5 ms
100 keys / 500 components 155.3 ms 13.1 ms

In Georg’s reported results, zustand is faster in the smallest cases, while nexus-state’s timings are lower from the 10-key workload onward. That pattern fits the implementation trade-off he describes: per-key subscriptions add overhead in small stores, but can avoid broader selector work as the number of keys and components grows. The article does not provide enough environment detail, repeated runs, or full methodology to reproduce the comparison independently, so the millisecond values should be read as results for those reported workloads—not as a universal ranking.

What the design progression teaches

  • A minimal shared store needs state access and a subscription mechanism; React rendering can be connected separately.
  • A dispatcher makes recognized update types explicit, while closure-based actions can remove the separate registration and routing layer.
  • Context can distribute a stable store reference while subscriptions handle changing data.
  • Features such as batching, provenance, persistence, middleware, and per-key listeners solve distinct coordination problems, but each adds implementation complexity.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.