Skip to content

aleclarson/immili

Repository files navigation

immili

Purpose

Minimal Immer-first local state for React applications with one root state tree, immutable snapshot reads, and synchronous atomic writes.

Installation

pnpm add immili react immer

immili expects react and immer 8 or newer to be installed by the consuming app.

Quick Example

import { createActions, createStateTree, useActions, useStateTree } from 'immili'

const AppState = createStateTree({
  counter: { value: 1 },
})

const AppActions = createActions(AppState, (draft) => ({
  counter: {
    increment() {
      draft.counter.value++
    },
  },
}))

export function Counter() {
  const state = useStateTree(AppState)
  const actions = useActions(AppActions, state)

  return (
    <button onClick={() => actions.counter.increment()}>
      {state.counter.value}
    </button>
  )
}

Documentation Map

About

State-action paradigm for vibe-coded React prototypes

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors