freshyo/apps/user-ui/src/store/appStore.ts
2026-11-01 14:15:17 +05:30

18 lines
No EOL
589 B
TypeScript

import { create } from 'zustand';
interface AppStore {
hideTabsNav: Record<string, boolean>;
setHideTabsNavKey: (key: string, hide: boolean) => void;
}
export const useAppStore = create<AppStore>((set) => ({
hideTabsNav: {},
// Writing the value a key already has would still allocate a new map and
// wake every subscriber (the tab navigator included), so bail out instead.
setHideTabsNavKey: (key: string, hide: boolean) =>
set((state) =>
state.hideTabsNav[key] === hide
? state
: { hideTabsNav: { ...state.hideTabsNav, [key]: hide } }
),
}));