In my React-Redux app, I am changing the redux state and it looks something like this
state {
key1: oldVal1
key2: oldArray1 //The value here is an array
.
.
.
}
Now when I update the state next time...
state {
key1: newVal1
//But for key2 I want to keep the value as the same oldArray1
//Now since that oldArray1 is not anywhere except in the old state, can I do this...?
key2: state.key2
.
.
.
}
So if I do key2: state.key2 and state.key2 is an array, will the reference be lost since state is changed and state.key2 won't point to anything?
I just want a rough explanation of how object/array references will affect state in redux.