JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="myList1">
<li>Coffee</li>
<li>Tea</li>
<li>Water</li>
<li>Milk</li>
</ul>
<p>Click the button to move the bottom item to the top of the list</p>
<button onclick='myFunction()'>Try it</button>
JavaScript
function myFunction() {
var list = document.getElementById("myList1");
list.insertBefore(list.firstElementChild, list.lastElementChild.nextSibling);
}