JSFiddle - React, Tailwind, and code Playground
HTML
<input type = "file" id = "archivo" />
<p id = "respuesta"></p>
CSS
p{
font-weight: bolder;
font-size: 1.2rem;
}
JavaScript
var archivo = document.getElementById("archivo"),
parrafo = document.getElementById("respuesta"),
tiposAceptados = /(jpeg|png|gif)/,
tipoArchivo;
archivo.addEventListener("change", function(){
tipoArchivo = this.files[0].type.split("/")[1];
parrafo.innerHTML = tiposAceptados.test(tipoArchivo) ? "Correcto" : "Incorrecto";
}, false);