JSFiddle - React, Tailwind, and code Playground
by harsh dand
HTML
<input type="file" name="file" class="file">
<button id="btn">Cool</button>
<img id="img">
JavaScript
document.getElementById('btn').addEventListener('click', clickHandler);
function clickHandler(){
var src = URL.createObjectURL(document.getElementsByName('file')[0].files[0]);
document.getElementById('img').setAttribute('src',src);
}