JSFiddle - React, Tailwind, and code Playground
HTML
<input type="file">
<div class="preview-nodeCenter nodeCenter fadeChange">
</div>
CSS
.nodeCenter{
border-radius: 50%;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
width:250px;
height:250px;
}
JavaScript
$('input').change(function() {
var fr = new FileReader;
fr.onload = function() {
var data = fr.result;
$( ".nodeCenter" ).css( "background-image", 'url(' + data + ')' );
//img.src = fr.result;
};
fr.readAsDataURL(this.files[0]);
});