JSFiddle - React, Tailwind, and code Playground

JavaScript

var myImg = new Image();

myImg.onload = function(){
   alert('loaded');
}
    
myImg.onerror = function(){
    alert('error: ' + this.src + ' is not valid image');
}

myImg.src = 'http://www.gravatar.com/avatar/e250dbf672ad95cd7bb500b9432ae780?s=32&d=identicon&r=PG';