open-index/open-npm huggingface dataset:
npm package: @fishx/store
Description: State management for FishX
Latest version: 1.0.1

# @fishx/store

> State management for fishx

## Installation

```sh
yarn add @fishx/store
```

## Quick Start

```js
import React from 'react'

import { createStore, observe } from '@fishx/store'

const store = createStore({
  count: 1,
  increment() {
    store.count++
  },
  decrement() {
    store.count--
  },
  async asyncIncrement() {
    await new Promise(resolve => setTimeout(resolve, 1000))
    store.count++
  },
})

const App = observe(() => (
  <div>
    <span>{store.count}</span>
    <button onClick={store.decrement}>-</button>
    <button onClick={store.increment}>+</button>
    <button onClick={store.asyncIncrement}>async+</button>
  </div>
))

ReactDOM.render(<App />, document.getElementById('root'))
```