JSFiddle - React, Tailwind, and code Playground

HTML

<div id="large">
  <img src="https://ak.picdn.net/assets/cms/5bb580387901a83212e3028ab5a2fa8fb1153d7b-img_offset_2x.jpg" />
</div>
<div id="small">
</div>

CSS

div {
  margin: 20px;
  padding: 10px;
}

#large {
  width: 600px;
  height: 400px;
  background-color: gray;
}

#small {
  width: 120px;
  height: 90px;
  background-color: orange;
}

img {
  width: 100%;
  height: 100%;
}

JavaScript

$(document).on("click", "#large > img", function() {
  $(this).appendTo("#small");
});
$(document).on("click", "#small > img", function() {
  $(this).appendTo("#large");
});