一键导入
zustand-stores
Zustand state management patterns - auth store with SSR-safe initialization and store best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Zustand state management patterns - auth store with SSR-safe initialization and store best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Reusable native component and template patterns for starter implementation
Starter data layer pattern with React Query + Zeus for Expo app
i18n baseline and dev-translate setup for Expo mobile starter
Expo Router conventions for route groups, native headers, and starter navigation
Baseline architecture for Axolotl mobile starter (Expo Router + reusable blocks)
Playwright E2E execution rules - domain-oriented specs, shared auth setup/storageState, idempotent zero-flake runs, verify-email-disabled support, and canonical Mailgun local email path
| name | zustand-stores |
| description | Zustand state management patterns - auth store with SSR-safe initialization and store best practices |
Zustand is for shared client state — UI preferences, sidebar collapsed, feature toggles, etc.
Auth state is managed by React Query (queryKeys.me cache + useAuth() hook) — not Zustand.
import { create } from 'zustand';
interface UIState {
sidebarOpen: boolean;
toggleSidebar: () => void;
}
export const useUIStore = create<UIState>()((set) => ({
sidebarOpen: true,
toggleSidebar: () => set((s) => ({ sidebarOpen: !s.sidebarOpen })),
}));
typeof window !== 'undefined' before accessing browser globalsuseUIStore((s) => s.sidebarOpen), never destructure the whole storeuseUIStore.getState()