Build a Dynamic Accordion Component for Groww FAQs
Groww aims to provide an excellent user experience, and a key part of that is easily accessible information. Our support section requires a robust and user-friendly FAQ component. This problem focuses on building a reusable Accordion component to display frequently asked questions and their answers, ensuring a smooth and intuitive interaction for our users. This task will test your ability to design a modular UI component, manage its state effectively, and incorporate essential accessibility features.
Your primary goal is to implement a Accordion component in React that meets the following requirements:
Accordion component that accepts an array of data items.id, title, and content (string).Accordion component to track which item is currently expanded.title and have a collapsible content area.Tab key. Pressing Enter or Space on a focused title should toggle its expanded state.Accordion component renders correctly with the provided faqData.Tab moves focus between accordion buttons, and Enter/Space toggles the focused item.aria-expanded, aria-controls, id, role) are used to convey the component's state and structure to assistive technologies.Constraints
faqData structure should be used as input.faqData is available upfront.Accordion component is structured, its props interface, and its potential for reuse.useState, useRef, etc.) to manage component state.Loading editor...