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?
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?