Skip to content
プロジェクト

bluebill1049/little-state-machine

GitHubで見る

概要

📠 状態を永続化して管理する 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

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Simple global state for React.

npm downloads npm License

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.

関連プロジェクトを探す

読み込み中…