JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="focusText"></input>
<button id="focusButton">Set Focus</button>

JavaScript

document.getElementById("focusButton").onclick = function()  {
    var inputElement = document.getElementById("focusText");
    var text = inputElement.value;
    inputElement.value=text;
    inputElement.focus()
}