React patterns — always apply error boundaries, loading states, accessible markup, proper hooks, controlled forms, stable keys, and correct memoization
87
80%
Does it follow best practices?
Impact
99%
1.83xAverage score across 5 eval scenarios
Passed
No known issues
Build a sales dashboard page in React with TypeScript. The page fetches sales data from /api/stats which returns { data: Stat[] } where each Stat has id: string, label: string, value: number, and trend: "up" | "down" | "flat".
Display the stats as a grid of cards. Each card shows the label, the formatted value (as USD currency), and an arrow icon indicating the trend direction.
Produce TypeScript/TSX files in a src/ directory:
src/types.ts -- TypeScript type definitionssrc/hooks/useStats.ts -- custom hook to fetch statssrc/components/StatCard.tsx -- individual stat cardsrc/components/Dashboard.tsx -- the dashboard page that uses the hook and renders cardssrc/App.tsx -- the app entry point that renders the dashboardThe code does not need to run against a real server. Do not include test files or build configuration.