プロジェクト
GitHubで見る
bluebill1049/little-state-machine
概要
📠 状態を永続化して管理する React カスタムフック
Web・アプリ開発できること
- Tiny, with no runtime dependencies
- State persistence with session storage by default
- Selectors to limit re-renders
計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 0
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルSimple global state for React.
Get started | Documentation | Quickstart
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.
関連プロジェクトを探す
読み込み中…