title: Swap objects in the array without mutating the array
body: <p>I am doing dragndropping and I need to swap the elements when swaping, there is an array of objects and the index of the active object and the one that is swapped, how can I swap them in js without mutating the original object</p>
  <pre><code>let allData = [{name:1},{name:2},{name:3}]
  </code></pre>
  <p>I need get after swapping</p>
  <pre><code>[{name:2},{name:1},{name:3}]
  </code></pre>
  <p>example what i need to do</p>
  <pre><code>case CHANGE_TAB_ORDER:
              const {activeElementIndex} = action.payload;
              const {swapedElementIndex} = action.payload
  
              return {
                  ...state,
                  stages: ? here i need to swap objects in array with  activeElementIndex and  swapedElementIndex
              }
  </code></pre>
  <p>stages is array of objects</p>