T8 React Store
Concise approach to React app state management aligned with React's state pattern, condensed to the essentials
npm i @t8/react-store
+ let store = new Store(0);
let Counter = () => {
- let [counter, setCounter] = useState(0);
+ let [counter, setCounter] = useStore(store);
let handleClick = () => {
setCounter(value => value + 1);
};
return <button onClick={handleClick}>+ {counter}</button>;
};
useState()