angulartypescriptreduxangular-redux

Redux with tassign in Angular(typescript) trying to join state.array and action.array but getting state.array.join is not a function?


Redux function:

  function setAllVideos(state, action) {
    return tassign(state, { allVideos: state.allVideos.join([action.data]) });}

Declaration + State:

allVideos: Array<Object>; 

AND

allVideos: [],

I just can't seem to get the syntax right on joining these together.


Solution

  • Correct should be

     return tassign(state, { allVideos: state.allVideos.concat(action.data) });