JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#first" data-simulate-hash="#first">1st Hash</a> |
<a href="#second" data-simulate-hash="#second">2nd Hash</a>
<div id="first" class="container">
1st hash
</div>
<div id="second" class="container">
2nd hash
</div>
CSS
.container {
display :none;
}
JavaScript
// yg ni if klik, boleh tukar ke dom ready
$(function(){
//e.preventDefault();
// yg ni aku simulate hash, sbb jsfiddle xsupport
// nnti ko tukar location.hash
var hash = location.hash; //first
$('.container#'+hash).siblings("div").hide().end().show();
})