Coding task · JavaScript and React course · Module 15: Patterns and Architecture

Practice: Final Project, Mission Control Dashboard

The project combines custom hooks (logic without JSX), compound components (Tabs, Tabs.Tab and Tabs.Panel share state through context, so there is no need to pass activeTab through props), Atomic Design (StatusBadge and ProgressBar are atoms, MissionCard is a molecule, MissionList is an organism) and composition (DashboardLayout with the header, sidebar and children slots). The updater function setValue((v) => !v) always gets the current state, which is why it also works inside a function from useCallback(..., []).

Task

Combine the patterns of the module in one dashboard. The useMissionData hook: ___BLANK1___ is the list of missions whose status equals the filter (when the filter is 'all', the hook returns every mission). The useToggle hook: ___BLANK2___ is an updater function that flips the previous value (toggle is wrapped in useCallback with an empty array, so it cannot read value from the first render). The Tabs compound component: ___BLANK3___ is the object with activeTab and setActiveTab that Tabs provides through TabsContext, and ___BLANK4___ sets aria-selected to true only for the active tab. The atoms, the molecule, the organism and DashboardLayout with its slots are ready.