This is a question about state in Redux js. I have an array list in the state:
{
list: list
}
According to Redux document, I should not modify the state in the reducer. I want to append a new item to the list. Should I clone the list, or simply append the new item to the list:
let newList = state.list;
newList.push(newItem);
return {
list: newList
}
The above code actually modify the original state, because the newList is the same list as "state.list". Is this an OK practice, or should I use immutableJS to clone the list?