RepositoryTypeScript
bluebill1049/little-state-machine
📠 React custom hook for persist state management
1.5kstars
51forks
1issues
2views
Features
- Tiny, with no runtime dependencies
- State persistence with session storage by default
- Selectors to limit re-renders
Install
npm install little-state-machine
Quickstart
import { createStore, useStateMachine } from 'little-state-machine';
createStore({ count: 0 });
function increment(state) {
return { ...state, count: state.count + 1 };
}
function Counter() {
const { actions, state } = useStateMachine({ actions: { increment } });
return <button onClick={() => actions.increment()}>{state.count}</button>;
}
Read the documentation for options, selectors, and TypeScript setup.
Similar Projects
Discover other similar projects and AI models.
30.6k
Nov 30, 2026
59.0k
Nov 23, 2026
4.9k
Nov 26, 2026
4.0k
Nov 28, 2026
1.4k
Nov 29, 2026
531
Oct 7, 2026
RepositoryTypeScript
StoneCypher/jssmFast, easy Javascript finite state machines with visualizations; enjoy a one liner FSM instead of pages. MIT; Typescripted; 100% test coverage. Implements the FSL language.
373
Nov 14, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCampfreeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
459.9k
Dec 2, 2026
4.3k
May 1, 2026