How to update redux state without creating new array

Viewed 33
export const initialState = {
   data: [1,2,3]
}

after success api request i am updating data state

 data: state.data.concat(...action.data.data) 

All the flat list items are getting re-render as concat is returning new array.(onReachEnd i am calling api for next page. and that data needs to added in redux state without updating whole array )

1 Answers

You can just destructure both

data : [...state.data, ...action.data.data]
Related