# React + Vite Dashboard Development Best practices for building admin/operations dashboards with React 19, Vite, Tailwind CSS v4, shadcn/ui, TanStack Query/Table, and Vitest. Distilled from community consensus and official docs (2025-2026). ## Stack Baseline | Layer | Tool | Notes | |---|---|---| | Framework | React 19 + TypeScript | ref-as-prop, useActionState, useOptimistic, React Compiler 1.0 | | Build | Vite + @vitejs/plugin-react | `moduleResolution: "bundler"` in tsconfig | | Styling | Tailwind CSS v4 (CSS-first) | `@import "tailwindcss"`, `@theme` directive, no JS config | | Components | shadcn/ui (new-york) + Radix | CVA variants, `cn()` utility, `asChild` pattern | | Data fetching | TanStack Query v5 | `queryOptions` factories, `useSuspenseQuery` | | Tables | TanStack Table v8 | `createColumnHelper`, server-side processing | | Forms | react-hook-form + Zod | `zodResolver`, discriminated unions for conditional fields | | Routing | React Router 7 | Framework or Data mode, nested layout routes | | Auth | oidc-client-ts + react-oidc-context | PKCE + refresh tokens, `automaticSilentRenew` | | Testing | Vitest + Testing Library + MSW v2 | happy-dom default, `userEvent.setup()` | | Icons | lucide-react | Tree-shakeable, consistent sizing | ## 1. Component Architecture ### Compound components for complex UI Root component owns shared state via Context; child subcomponents read it. Mirrors native HTML semantics (`