stook
TypeScript icon, indicating that this package has built-in type declarations

1.17.0 • Public • Published

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.vercel.app.

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

Readme

Keywords

none

Package Sidebar

Install

npm i stook

Weekly Downloads

159

Version

1.17.0

License

MIT

Unpacked Size

42.4 kB

Total Files

17

Last publish

Collaborators

  • forsigner