qwark
creates a global useState
hook. No Context. No Providers. With useState
-like API
npm install qwark
or yarn:
yarn add qwark
import qwark from "qwark";
const useCountQwark = qwark(0); // call with initial state
const Button = () => {
const [count, setCount] = useCountQwark();
return <button onClick={() => setCount(count + 1)}>Increment</button>;
};
const Count = () => {
const [count] = useCountQwark();
return <p>{count}</p>;
};