import { useStore } from "zustand"; import { useContext } from "react"; import type { MenuStore } from "../store/menu-store"; import { StoreContext } from "../providers/store-provider"; export const useMenuStore = (selector: (store: MenuStore) => T): T => { const storeContext = useContext(StoreContext); if (!storeContext) { throw new Error("useMenuStore must be used within StoreProvider"); } return useStore(storeContext.menuStore, selector); };