JSFiddle - React, Tailwind, and code Playground

HTML

<input name="searchTxt" type="text" maxlength="512" id="searchTxt" class="searchField"/>
<input type="button" value="Get Value" onclick="show()">

JavaScript

searchTxt = {
	value: 'cool'
};
var show = function () {
  alert(searchTxt.value); // showing wrong result as global variable is mutated
}