Closed SrBrahma closed 3 years ago
sure, that's the whole point of this library.
setGlobalState: a function to set a global state by key outside React
const { useGlobalState, setGlobalState } = createGlobalState({ count: 0 });
setGlobalState('count', 1);
Damn, haha! I was expecting* to get some workaround, not a built in way.
Thanks for the quick answer, and also, for the package!
In MobX, for example, I can change at any place a value that will cause the related components to re-render.
MobX would solve my issue, but, it's a bit of overkill, as your package is much lighter.
Is it possible to change a global state outside a component?