How do I add elements in my array arr[] of redux state in reducer? I am doing this-
arr[]
import {ADD_ITEM} from \'../Actions/UserActions\' const ini
Two different options to add item to an array without mutation
case ADD_ITEM : return { ...state, arr: [...state.arr, action.newItem] }
OR
case ADD_ITEM : return { ...state, arr: state.arr.concat(action.newItem) }