react-state-machines
Installation
SKILL.md
React State Machines with XState v5
Overview
State machines make impossible states unrepresentable by modeling UI behavior as explicit states, transitions, and events. XState v5 (2.5M+ weekly npm downloads) unifies state machines with the actor model—every machine is an independent entity with its own lifecycle, enabling sophisticated composition patterns.
When to Use This Skill
Trigger patterns:
- Boolean flag explosion: multiple
isLoading,isError,isSuccessflags - Implicit states: writing
if (isLoading && !isError && data)to derive mode - Defensive coding: guards before state updates to prevent invalid transitions
- Timing coordination: timeouts, delays, debouncing across states
- State dependencies: one state depends on another to update correctly