I am learning to use Mob-x-state tree in my pet project. And i have one problem:
I need to handle websocket events with my store like this:
const {
AccountsStore
} = useStore();
blablalbalba
socket.onopen = function () {
AccountsStore.handleWsStart();
};
I am trying to use AccountsStore.handleWsStart(); from my store:
.actions(self => ({
// note the `({`, we are returning an object literal
handleWsStart() {
self.isFetching = true;
}
And have this issure:
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons
I understand what i am doing wrong, cant you tell me how i can access to mobx-state-tree-action not from a FC component or antother way to handle WS events to store?