JSFiddle - React, Tailwind, and code Playground
by Qwerty_Wasd
HTML
<ul>
<li>1</li>
<li>2</li>
<li class="activeRed">3</li>
<li>4</li>
</ul>
CSS
.activeRed{
color:red;
}
JavaScript
let collection = document.querySelector('.activeRed').parentElement.children;
for (e of collection) {
if (e !== collection[collection.length - 1]) e.classList.add('activeRed');
}