JSFiddle - React, Tailwind, and code Playground
HTML
<div style="height: 1337px;">
scroll down...
</div>
<button id="a">1. click twice</button>
<button id="b">2. click once</button>
CSS
$("#a").click(function() {
history.pushState(
{},
"",
window.location.href.split("#")[0] + "#a"
);
return false;
});
$("#b").click(function() {
history.back();
return false;
});