How to access specific index in array and change its background?

Viewed 47

Im making a pagination in react my problem is that when the page loads it should set color to 1st element in array indicating page 1 and also if i click the 1st or last button is should highlight the 1st or last page.Css focus works only if i click the page number.

<button>First Item</button>
<div>{pages number}</div> // 1,2,3,4,5,6,7,8,9
<button>Last Item</button>

.btnpage{
background-color:green;
}

.btnpage:focus {
      background-color: red;
      color: white;
    }
0 Answers
Related