bcherny / undux

⚡️ Dead simple state for React. Now with Hooks support.
https://undux.org
MIT License
1.49k stars 31 forks source link

Access store from a non component function. #130

Closed Berkays closed 3 years ago

Berkays commented 3 years ago

I currently want to have a single function that modifies the state but it's not possible to do so because of hooks "Invalid hook call. Hooks can only be called inside of the body of a function component." error.

The reason i want to do this is to share same code between components that import this function. With redux this was possible using dispatches but i wasn't able to achieve the same functionality. Is this possible?