JSFiddle - React, Tailwind, and code Playground
HTML
<div id="list">
<ul>
<li>
<a href="#">Some link</a>
</li>
</ul>
</div>
<div id="selector">
</div>
JavaScript
$("#list li a").on('click', function() {
var val = $(this).html();
$("#selector").html(val);
localStorage.setItem("currentlist", val); //add to localStorage
});
$(document).ready(function() {
var name = localStorage.getItem("currentlist"); //get from localStorage
$("#selector").html(name); //assign here
});