Track your progress, run tests, and get AI feedback
Run code and see test results
Submit and get AI-powered feedback
Track which problems you've solved
Build an Accessible React Tabs Component with Dynamic Content
GadgetGrove, an innovative online tech retailer, wants to enhance its product detail pages. Your task is to build a reusable and accessible Tabs component that dynamically displays different sections of product information. This problem focuses on state management, component composition, and fundamental accessibility practices in React.
Tabs component that accepts an array of tab items, where each item has a label (string) and content (ReactNode).Enter or Space on a focused tab label should activate that tab.role="tablist", role="tab", aria-selected, tabindex, aria-controls, role="tabpanel", aria-labelledby) are used for tabs and tab panels to convey their structure and state to assistive technologies.Tabs component renders all provided tab labels in a horizontal list.ArrowLeft and ArrowRight keys correctly moves focus between tab labels.Enter or Space on a focused tab label activates that tab.localStorage or URL parameters) is out of scope.Tabs component from scratch using raw React and CSS.content for each tab item can be a string, a ReactNode, or a custom component. The Tabs component should render it directly.Constraints
styles.css). No CSS-in-JS or preprocessors are required.useState is sufficient.