TaskFlow is still a single-file app. Your job is to break it into four focused components and compose them with a CSS Grid layout.
A multi-component layout with a persistent header, sidebar navigation, main content area, and footer — each living in its own file.
┌────────────────────────────────────────┐
│ Header │
├──────────────┬─────────────────────────┤
│ │ │
│ Sidebar │ MainContent │
│ │ │
├──────────────┴─────────────────────────┤
│ Footer │
└────────────────────────────────────────┘
-
Create
src/components/Header.tsx- Renders a
<header>element - Contains the TaskFlow logo text (
<h1>TaskFlow</h1>) and a placeholder<nav>
- Renders a
-
Create
src/components/Sidebar.tsx- Renders an
<aside>element - Contains a
<nav>with three hardcoded links: Dashboard, Projects, Team
- Renders an
-
Create
src/components/MainContent.tsx- Renders a
<main>element - Contains a welcome heading and a short descriptive paragraph
- Renders a
-
Create
src/components/Footer.tsx- Renders a
<footer>element - Contains the "Built with React + TypeScript" credit line
- Renders a
-
Update
src/App.tsx- Import all four components
- Remove the inline JSX and compose the components instead
- Use a CSS Grid layout (see
App.css)
-
Update
src/App.css- Add a CSS Grid layout using
grid-template-areas:"header header" "sidebar main" "footer footer"
- Add a CSS Grid layout using
- Each component lives in its own file inside
src/components/ App.tsximports and renders all four components- The layout is visually correct: header spans full width, sidebar left, main right, footer spans full width
- All components use the correct semantic HTML element (
<header>,<aside>,<main>,<footer>) - Every component uses a named export (e.g.
export function Header()) - No single component exceeds 30 lines of JSX
npm run buildpasses with zero TypeScript errors
| Mistake | Correct |
|---|---|
class="..." |
className="..." |
| Multiple root elements | Wrap in <div> or <>...</> |
<input> without closing |
<input /> |
| Default-only export | Add named export too |
| Forgetting to import the component | Add import { Header } from './components/Header' |
- JSX is not HTML. Attributes follow camelCase (
onClick,tabIndex) and every tag must be explicitly closed. - A component file must return a single root element. Use a React Fragment
(
<>...</>) when you need multiple siblings without an extra DOM node. - File names for components conventionally match the component name exactly:
Header.tsxexportsHeader. - Named exports keep the name consistent across the codebase and work better with IDE auto-import.
cd start/
npm install
npm run devOpen http://localhost:5173 to see the starting point.