JSFiddle - React, Tailwind, and code Playground
JavaScript
const list = ['a', 'b', 'c']
const newIndex = 0
const oldIndex = 2
console.log(list)
const updatePosition = list => list.splice(newIndex, 0, list.splice(oldIndex, 1)[0])
updatePosition(list)
console.log(list)