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

@octanejs/xstate

v0.0.17

Published

XState tools for Octane — reuses the framework-agnostic xstate actor core unchanged and ports the @xstate/react 6.1.0 binding onto Octane hooks.

Readme

@octanejs/xstate

XState for Octane — a port of @xstate/[email protected].

The xstate actor core is framework-neutral and has no runtime dependencies, so it is reused unmodified as a peer dependency. Only the React binding is ported. See UPSTREAM.md for the pin, the module and export crosswalk, and the disposition of every upstream test.

npm install @octanejs/xstate xstate
pnpm add @octanejs/xstate xstate

Usage

import { createMachine } from 'xstate';
import { useMachine } from '@octanejs/xstate';

const toggleMachine = createMachine({
	id: 'toggle',
	initial: 'inactive',
	states: {
		inactive: { on: { TOGGLE: 'active' } },
		active: { on: { TOGGLE: 'inactive' } },
	},
});

export function Toggle() @{
	const [state, send] = useMachine(toggleMachine);

	<button onClick={() => send({ type: 'TOGGLE' })}>
		{state.value as string}
	</button>
}

createActorContext works exactly as upstream, including the member-call form:

import { createActorContext } from '@octanejs/xstate';

const ToggleContext = createActorContext(toggleMachine);

function Display() @{
	const value = ToggleContext.useSelector((state) => state.value as string);
	<span>{value}</span>
}

export function App() @{
	<ToggleContext.Provider>
		<Display />
	</ToggleContext.Provider>
}

Exports

useActor, useActorRef, useSelector, useMachine (deprecated upstream alias of useActor), createActorContext, shallowEqual — the complete @xstate/[email protected] surface.

Intentional differences from @xstate/react on React

  • No StrictMode double-invoke. Octane has no StrictMode, so effects, renders, and observer notifications fire once where React's development StrictMode fires them twice. Production counts are identical. Upstream's own suite parametrizes eight assertions over both modes; the non-strict values are this port's contract.
  • useSyncExternalStore skips React's commit-time getSnapshot re-read when the rendered value was unchanged, because Octane's synchronous renderer closes the concurrent-interleaving window React guards there. An actor always notifies, so this is not reachable through this binding's public API.
  • Error boundaries are @try/@catch blocks, not class components. An actor whose snapshot enters the error status still throws from render and is caught by the nearest boundary; only the way you write the boundary changes.
  • Server snapshots. getServerSnapshot is optional in Octane and falls back to getSnapshot; React throws when it is missing. Both ported hooks always supply one.

stopRootWithRehydration is kept verbatim even though its motivating case (React Strict Effects) cannot occur here, because it also governs unmount-then-remount, which stays observable to consumers.