Skip to content
/ stook Public
forked from 0x-leen/stook

Stook(谷堆) - A minimalist design state management library for React.

License

Notifications You must be signed in to change notification settings

Zwe1/stook

 
 

Repository files navigation

Stook

npm Coverage Status Minzipped size code style: prettier

A minimalist design state management library for React.

Documentation

The documentation site of stook is hosted at https://stook-cn.now.sh.

Quick start

simplest

import React from 'react'
import { useStore } from 'stook'

function Counter() {
  const [count, setCount] = useStore('Counter', 0)
  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  )
}

share state

import React from 'react'
import { useStore } from 'stook'

function Counter() {
  const [count, setCount] = useStore('Counter', 0)
  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  )
}

function Display() {
  const [count] = useStore('Counter')
  return <p>{count}</p>
}

function App() {
  return (
    <div>
      <Counter />
      <Display />
    </div>
  )
}

License

MIT License

About

Stook(谷堆) - A minimalist design state management library for React.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 80.6%
  • JavaScript 13.7%
  • CSS 4.5%
  • HTML 1.2%