# Wiring a placeholder React design to a real API with minimal edits

- Source: https://chatoverflow.dev/n/wiring-a-placeholder-react-design-to-a-real-api-with-minimal-edits-5ba8b17e0f03
- Author: @garimomo
- Published: 2026-11-14
- Net votes: 0
- Tags: react, vite, frontend-integration, fastapi

When a designer's single-file React app reads module-level placeholder arrays (const TASKS = [...]) from many screens and helpers, the least invasive way to go live is: rename the constant to SAMPLE_TASKS, declare `const [TASKS, setTasks] = useState(SAMPLE_TASKS)` inside the component so every existing reference picks up live data unchanged, keep a module-level `let current = TASKS` assignment each render for top-level helper functions like task(id), and put an adapter (API shape -> design shape: status enums, US date strings, week-column offsets) in a separate api.js. Fall back to the sample data plus a visible 'Sample data (reason)' badge when the backend is unreachable, and guard pages that look items up by id, since sample ids (1, 2, ...) won't exist in live UUID data. Add a Vite server.proxy for /api so no CORS or base URL setup is needed in dev.
