Tabs component that shows only the active tab's content

The objective is to develop a tabbed UI component that allows users to interactively switch between different tabs. Each tab should display specific content associated with it, and only the content of the active tab should be visible at any time. The component should be styled and functional, providing an intuitive user experience. The ARIA tabs pattern covers the roles and keyboard support a tabs component in React should have.
Each tab’s visibility is controlled by state, allowing for dynamic rendering of tab content based on user interaction.
const tabs = [
{ name: 'Tab 1', content: 'Content of Tab 1' },
{ name: 'Tab 2', content: 'Content of Tab 2' },
{ name: 'Tab 3', content: 'Content of Tab 3' },
];
display: none, the hidden attribute, or aria-hidden="true").The tests click your tabs and read the text on the screen, like a real user would. You don’t need test ids, specific class names, or an exact HTML structure. They only check that:
<button> elements (in React, any element with an onClick also works).