Skip to content
Proyek

bluebill1049/little-state-machine

Lihat di GitHub

Tentang

Custom hook React untuk manajemen state yang persisten.

Pengembangan web dan aplikasi

Cara angka ini diukur

Yang dapat Anda lakukan

  • Tiny, with no runtime dependencies
  • State persistence with session storage by default
  • Selectors to limit re-renders

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
0
dalam 1 bulan
0

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

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.

Jelajahi proyek terkait

Memuat…