JSFiddle - React, Tailwind, and code Playground
HTML
<a href="test.html" class="first">First</a>
<a href="test2.html" class="second">Second</a>
<br /><br />
<a href="test.html" class="first">First</a>
<a href="test2.html" class="second">Second</a>
CSS
.highlight { border:1px solid red }
JavaScript
$("a").hover(function() {
$('.' + $(this).attr('class')).addClass('highlight');
}, function() {
$('.' + $(this).attr('class').split(' ')[1]).removeClass('highlight');
});