JSFiddle - React, Tailwind, and code Playground
HTML
<input type="file" accept="image/*" onchange="validateFileFormat()" id="i" />
JavaScript
window.validateFileFormat = function(){
alert( ( new RegExp( i.accept.replace( '*', '.\*' ) ) ).test( i.files[ 0 ].type ) );
}