.map(i){
...
let classes = "tablinks"
if(i === active){
classes = classes + " active"
}
return(
<button
className={classes}
onClick={openTab}
data-index={i}
>
{n.title}
</button>
)
}
<button
className={
(() => {
if (i === active) {
return 'tablinks active';
} else {
return 'tablinks';
}
})()
}
onClick={openTab}
data-index={i}
>{n.title}</button>