2.1.2 • Published 4 years ago

react-statey v2.1.2

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

react-statey

Yet another tiny & simple global state-manager. Less than 1 KB (minified).

No redux, no context, no verbose boilerplates. TypeScript support.

Demo

Click here for Demo

Usage example

npm i react-statey
import { createState } from 'react-statey';

// this creates a global state hook, and can be used globally throughout the app
const useCounterState = createState(0);

const YourComponentA = () => {
  const [counter, setCounter] = useCounterState();

  return (
    <button onClick={() => setCounter(counter + 1)}>
      Value is {counter}
    </button>
  );
};

const YourComponentB = () => {
  const [counter, setCounter] = useCounterState();

  return (
    <button onClick={() => setCounter(counter + 1)}>
      Value is {counter}
    </button>
  );
};

License

react-statey is MIT licensed.

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago