When I get the data (view) from useStore, I have to write all the way to this (view: myStore.menu.view) and still wrap it all in useObserver. Is there a way to shorten the code, but still keep the logic the same? I use Mobx and React Hooks.
Thanks in advance!
function useBasketStore() {
const { myStore } = useStore(['exampleStore']);
return useObserver(() => ({
view: myStore.menu?.view,
}));
}
const BasketScreen = () => {
const { view } = useBasketStore();
......
}