A small typed React hook for finite state machines with guards, context, event payloads, and entry/exit actions. About 100 lines, zero dependencies.
Covers ~70% of what people reach for XState for. Stops short of hierarchical states, parallel states, and actors — when you need those, graduate to XState.
useStateMachine.ts— the hook, reducer, and typesmachineSpec.ts— example machine definition (connection lifecycle with retries)