<div className="pagination">
<br />
<center>
{[...Array(this.props.pages+1)].map((x, i) =>
<h2 key={i} onClick={()=>this.demoMethod(i+1)} className="tc">{ i+1 }</h2>
)}
</center>
</div>
Here in my code i wants to write if else statement . Actually it is a pagination logic. i wants to change color of h2 for active page. so i wants to write if statement inside this.
Please share any idea how i can do it..