Is there a way to create Mobx store with navigate property? Something like this:
const navigate = useNavigate();
const location = useLocation();
const mobxStore = useMemo(() => RootStore.create({ routeNavigate: navigate }, INITIAL_STORE), []);
as a result i want to get something like this:
.model('RootStore', {
routeNavigate: types.function
})
Because in this example routeNavigate is undefined. So i tried to add in RootStore identifier for a routeNavigate, like:
routeNavigate: types.frozen() or
routeNavigate: types.function
and it throws errors in console.
- I tried to add different identifiers to routeNavigate
- Tried to pass property in RootStore.create