Build a calendar date picker as a single React component. It is more than a styled grid: you track two separate facts — the month you are looking at (the view) and the day you have picked (the selection) — and derive the whole grid from a little date math.
The starter App.tsx already renders July 2026 as a static grid (a buildMonth helper computes the day count and the leading blanks). Make it interactive:
useState({ year: 2026, month: 6 }) and the selected ISO date in useState<string | null>(null). Build the grid from the view.selected to the ISO string (2026-07-15), highlight that day, and show Selected: <iso> (else No date selected) in the status line.Date tricks. new Date(y, m + 1, 0).getDate() is the day count; new Date(y, m, 1).getDay() is the weekday offset for the leading blanks.YYYY-MM-DD), so it is easy to show and compare; a day highlights only when its ISO equals selected.styles.css; focus on the state and the navigation.Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.