JSFiddle - React, Tailwind, and code Playground

HTML

<input id="text" type="text" />
<input id="add" type="button" value="Adicionar" />

JavaScript

var text = document.getElementById("text");
var add = document.getElementById("add");
add.addEventListener("click", function () {
	history.pushState(text.value, document.title, "/");
})

window.addEventListener("popstate", function(evt){
  text.value = evt.state
});