JSFiddle - React, Tailwind, and code Playground

HTML

<div id="main"></div>

JavaScript

$('#main').on('mouseenter mouseleave', '#img', function(e) {
    $(this).attr('src', 'http://dummyimages.com/' + (e.type == 'mouseenter' ? '200x200/000/fff' : '200x200/fff'));
});

$('#main').append('<img id="img" src="http://dummyimages.com/200x200/fff">');