Implement the Tabs component that renders several tabs and allows the user to switch between them.
Here is the working version
The App should communicate with the Tabs component using the following props:
tabs- an array of tab objects to be rendered asTabs;activeTabId- theidof the tab that should be active;onTabSelected- a callback executed with theidof a just selected tab when the user clicks on it.
The Tabs component should be stateless (does not have an internal state, only props).
Follow the next requirements to pass the tests:
- Render tabs in a list (
<ul>); - Each
<li>should have adata-cy="Tab". - The
<li>of an active tab should have theis-activeclass. - If
activeTabIddoes not match any object in thetabsarray, the first one should be active. - Add a link with
data-cy="TabLink"and ahrefto#tab-idinside every<li>(see the markup). - The
Tabscomponent should render the content of the active tab in the element withdata-cy="TabContent". - Call
onTabSelectedonly when the user selects a non-active tab. - Use the title of the active tab in the
<h1>of theAppcomponent in the following format:Selected tab is Tab 1.
- Install the Prettier Extension and use these VSCode settings to enable format on save.
- Implement a solution following the React task guidelines.
- Open one more terminal and run tests with
npm testto ensure your solution is correct. - Replace
<your_account>with your Github username in the DEMO LINK and add it to the PR description.