JSFiddle - React, Tailwind, and code Playground
HTML
<input type="password" name="pwd" id="pwd" />
<input type="checkbox" name="show" id="show" onclick="showhide('pwd','show');">
JavaScript
function showhide(pwd,show)
{
var epwd = document.getElementById(pwd);
var eshow = document.getElementById(show);
epwd.type = eshow.checked ? 'text' : 'password';
}