Redux - Remove an Item from an Array

Tell us what’s happening:
Maybe a clear description of why this WONT work
will clarify some overall something for me…
i already figure a spread operator WILL work
(im gonna refactor right after posting this, actually)…
but syntactically… why doesnt this solve

Your code so far

const immutableReducer = (state = [0,1,2,3,4,5], action) => {
  switch(action.type) {
    case 'REMOVE_ITEM':
      // Don't mutate state here or the tests will fail
      return state.slice(0 , action.index).concat(state.slice(action.index + 1,state.length))
    default:
      return state;
  }
};

const removeItem = (index) => {
  return {
    type: 'REMOVE_ITEM',
    index
  }
}

const store = Redux.createStore(immutableReducer);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0

Challenge: Redux - Remove an Item from an Array

Link to the challenge:

It did work…
:blush: :grinning:
:face_with_diagonal_mouth:
:melting_face: why doesnt ^^^ work though :melting_face:
i wanna understand the REDUPHYSIX of it all I guess :melting_face:
:face_with_diagonal_mouth:

like am i not syntactical with my array structuring in the “solutiion code” I WROTE?
i get that it doesnt n i aint mad about it
:slightly_smiling_face: :100:
but whyyyyy
:woozy_face: :slightly_smiling_face: :upside_down_face: :melting_face:
but why

The code you posted passed the tests for me.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.