JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#one">One</a>
<a href="#two">Two</a>

<div id="one">One</div>
<div id="two">Two</div>
<div id="hash"></div>

CSS

div.selected {background: #000;}

JavaScript

$(document).ready(function(){
    var hash = window.location.hash;
    $("#hash").html(hash);
    $("div").removeClass("selected");
    $(hash).addClass("selected");
});