JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrapper">
<img id="img1" src="http://www.html.am/images/samples/remarkables_queenstown_new_zealand-300x225.jpg" />
<img id="img2" src="http://www.primeliving.at/wp-content/uploads/2016/12/terrasse_ref38_klein_640x480-300x225.jpg" style="display: none" />
</div>
<button onClick="togglethis()">
Toggle images!
</button>
JavaScript
var toggler=true;
function togglethis(){
if(toggler){
document.getElementById("img2").style.display="inherit";
document.getElementById("img1").style.display="none";
}else{
document.getElementById("img1").style.display="inherit";
document.getElementById("img2").style.display="none";
}
toggler=!toggler;
}