index.ts
360 Bytes
import { useState } from 'react';
import { createStore } from 'hox';
export const [useGlobalStore, GlobalStoreProvider] = createStore(() => {
const [count, setCount] = useState(0);
const increase = () => {
setCount(count + 1);
};
const decrease = () => {
setCount(count - 1);
};
return {
count,
increase,
decrease,
};
});