hunghg255 / jotai-tiny

State management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jotai-tiny

Reactjs State Manager with no dependencies

npm version npm npm All Contributors

Demo

Demo

Installation

NPM

Require

react >= 18

To install the latest stable version:

npm install --save jotai-tiny

Basic usage:

import { atom, useAtom, useAtomValue } from "jotai-tiny";

const atomCount = atom(0);
const atomCount1 = atom(1);

// const totalCountAtom = atom((get) => get(atomCount) + get(atomCount1));
// const dataAtom = atom(() => fetch("/data.json").then((res) => res.json()));

const App = () => {
  const [count, setCount] = useAtom(atomCount)

  return <>
    <h5>{count}</h5>
    <button onClick={() => setCount(count + 1)}>Click</button>
  </>;
}

About

State management

License:MIT License


Languages

Language:TypeScript 87.9%Language:HTML 12.1%