--- title: Tabs tags: visual,state,children,intermediate --- Renders a tabbed menu and view component. * Define a `TabItem` component, pass it to the `Tab` and remove unnecessary nodes expect for `TabItem` by identifying the function's name in `props.children`. * Use the `React.useState()` hook to initialize the value of the `bindIndex` state variable to `props.defaultIndex`. * Use `Array.prototype.map` on the collected nodes to render the `tab-menu` and `tab-view`. * Define `changeTab`, which will be executed when clicking a ` ))}
{items.map(({ props }) => (
))}
); } ``` ```jsx ReactDOM.render( Lorem ipsum Dolor sit amet , document.getElementById('root') ); ```