JSFiddle - React, Tailwind, and code Playground

HTML

<p>Failing image <br />
    <img onerror="handle(this,'http://jsfiddle.net/img/logo.png','fail')" onload="handle(this,'http://jsfiddle.net/img/logo.png','')" src="http://a3.twimg.com/profile_images/522455109/calvin-and-hobbessm_normal.jpg" />
</p>
<hr />
<p>
Loading image <br />
    <img onerror="handle(this,'http://jsfiddle.net/img/logo.png','fail')" onload="handle(this,'http://jsfiddle.net/img/logo.png','')" src="http://highslide.com/samples/full2.jpg" />
</p>

JavaScript

function handle( elem, img, state )
{
    if (
        (typeof(elem.onerror) === 'function' && state === 'fail') 
        || (elem.width === 0)
        )
         {
           elem.src = img;
         }
}