JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file" accept="image/*" id="image" />
<img id="img" />

CSS

img {
    border:0px;
}

JavaScript

document.getElementById("image").addEventListener('change',function(e){
    var url = window.URL.createObjectURL(e.target.files[0].name);
    alert(e.target.files[0].name);
    document.getElementById("img").src = url;
},false);