JSFiddle - React, Tailwind, and code Playground

HTML

<div id="root">
</div>

<!--
Build a tab component using plain HTML/CSS/JavaScript.

In case you forget any API method, attribute name, etc, you can search on any reference website like MDN, etc. You are not allowed to search for the solution of the problem.

Try to use all the best practices you know about HTML, CSS and JavaScript to build this component.

Mockup:
https://i.imgur.com/Qk71XWl.jpg

Please make the component fully functional. The content can be static in the HTML.
-->

React

const divElement = document.getElementById("root");

				
const Tab = (props) => {
		return (
			<li>
				<input type="button" 
					value={props.value} 
					id={props.id} 
					onClick = {props.onClick}
				/>
			</li>
		);
};

class Main extends React.Component {

	constructor(props) {
		super(props);
		
		this.state = {
			currentText : ""
		}
	}

	clickHandler(event) {
		this.setState({
			currentText : `you are in button ${event.target.id}`
		});
	}
	render() {
	const totalTabs =4;
	let tabnum = 1;
	let tabArr =[];
	while(tabnum <= totalTabs) {
		tabArr.push(<Tab key={tabnum}
							value={`Button ${tabnum}`} 
							id={tabnum}
							onClick={this.clickHandler.bind(this)}/>);
		tabnum++;
	}
		return (
			<div>
				<div>
					<ul>	
						{tabArr}
					</ul>
				</div>
				<p>{this.state.currentText}</p>
			</div>
		);
	}

}
ReactDOM.render(
				<Main/>, 
				divElement);