Coding task · JavaScript and React course · Module 10: React Ecosystem and Future
Practice: Server and Client Components
In Next.js (App Router) components are server components by default: they can be async and fetch data directly (await), but they cannot use useState or handle clicks. You move interactive parts to files with the 'use client' directive and pass them server data through props (the data must be serializable). A Server Component renders a Client Component, not the other way round.
Task
Build the missions page in the App Router architecture: MissionsPage is an async Server Component, and MissionFilter is a Client Component with state. ___BLANK1___: MissionsPage waits for the data from getMissions() (await). ___BLANK2___: pass the mission list to MissionFilter through the missions prop. ___BLANK3___: when Active only is checked, the filter keeps the missions with the status 'active'. The Server Component has no state and no event handling - all of that lives in the client component. The editor preview pretends to be Next.js, so the page shows up after about half a second.