How to append elements in an array to another array using Ramdajs with a single line statement?
state = {
items:[10,11,]
};
newItems = [1,2,3,4];
state = {
...state,
taggable_friends: R.append(action.payload, state.taggable_friends)
};
//now state is [10,11,[1,2,3,4]], but I want [10,11,1,2,3,4]
Ramda's
append
works by "pushing" the 1st param into a clone of the 2nd param, which should be an array:In your case:
Instead use RamdaJS's
concat
, and reverse the order of the parameters: