Loading homepage
Build a reusable accordion that reveals a topic's content when its heading button is clicked. Each group can have at most one panel open, and clicking its open heading closes the group.
The supplied page includes primary and secondary groups, an empty group, and a single-item group. Add local state and click behavior to the starter component. All panels start closed, and the demo content and CSS are already provided.
Input: Initial render Output: All six panels are mounted and hidden. The empty group has no headings or panels.
Input: Click HTML in the primary group Output: HTML structures the page. is visible; CSS and JavaScript remain hidden.
Input: With HTML open, click CSS in the primary group Output: CSS styles the page. is visible and the HTML panel is hidden.
Input: Click the open CSS heading again Output: Every primary panel is hidden.
Input: Open React in the secondary group Output: React builds interfaces. is visible; the primary and single-item groups keep their current state.
Each group begins fully collapsed. A heading toggles its own content, and opening another heading closes the previous panel within that group.