JSFiddle - React, Tailwind, and code Playground
by nirus
HTML
<div id="div1"></div>
<div id="div2">
<div id="div3" ><img width="200px" src="https://lizstanleydotme.files.wordpress.com/2013/12/twitter-small-biz.png" id="image" onclick="change(this.src);"/></div>
</div>
CSS
#div1{
width: 100px;
height: 100px;
background-size: 100px 100px;
}
JavaScript
function change(src){
document.getElementById("div1").style.backgroundImage = 'url('+src+')';
};