title: How can I add additional items to a store array and still be able to set the array to empty when resetting?
body: <p>I've set up a Store.js with a players array. I want to add players to the array as I select them but still be able to set the array to empty if I clear the array.</p>
  <p>Here is some code from my Store.js</p>
  <pre><code>const initialState = {
      playerCollection: [],
  }
  
  
  const reducer = (state, action) =&gt; {
      switch (action.type) {
          case 'UPDATE_PLAYER_COLLECTION':
            return { ...state, playerCollection: action.value };
  
          default:
            return state;
      }
  }
  </code></pre>
  <p>Here is some code from my Players.js</p>
  <pre><code>for(let i=0; i&lt;players.length; i++){
      let player = players[i];
      
      if(player.position === state.posAbbr &amp;&amp; player.status === 'ACT'){
          let newPlayer = createNewPlayer(roster, player);
  
          dispatch({ type: 'UPDATE_PLAYER_COLLECTION', value: [...state.playerCollection, newPlayer] });
          return;
      }
  }
  </code></pre>
  <p>My dispatch line is only adding a single player to the playerCollection array.
  I also want to, like I said above, be able to set the array to [] if I clear it.</p>