0.16.0 • Published 1 month ago

@opentf/react-state v0.16.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

 OPEN TECH FOUNDATION

React State

Build

A global state manager for React.

View Demo | Documentation

Features

  • Simple API
  • Mutable State Updates
  • No Context Providers
  • Auto Shallow Diff Computed Props
  • TypeScript Support

Installation

npm install @opentf/react-state
yarn add @opentf/react-state
pnpm add @opentf/react-state
bun add @opentf/react-state

Usage

import { create } from '@opentf/react-state';

const { useAppState, setAppState, api } = create({ count: 0 });

api.subscribe(console.log);

export default function App() {
  const count = useAppState((s) => s.count);

  return (
    <>
      <p>Count: {count}</p>
      <button
        onClick={() =>
          setAppState((s) => {
            s.count++;
          })
        }
      >
        Increment
      </button>
    </>
  );
}

Related

License

Copyright (c) 2021, Thanga Ganapathy (MIT License).

0.16.0-next.0

1 month ago

0.16.0

1 month ago

0.15.0

3 months ago

0.14.0

3 months ago

0.14.1

3 months ago

0.13.1

1 year ago

0.13.0

1 year ago

0.12.1

1 year ago

0.12.0

1 year ago

0.11.2

1 year ago

0.11.1

1 year ago

0.11.0

1 year ago