JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file" id="fileInput">

JavaScript

$('#fileInput').on('change',function(){
    if($(this).files.length > 0){ // only if a file is selected
        var fileSize = $(this).files[0].size;
        console.log(fileSize);
    }
 });