Reputation:
I am using redux with react.
I am updating the state which looks like this
state = {
album: {
name: 'Blood, Sugar, Sex, Magik'
date: '1991',
artist: 'RHCP'
}
}
The relevant part of my reducer looks like this
case 'UPDATE_ALBUM_NAME_SUCCESS':
return {
...state,
album: {
...album,
name: action.name,
},
};
action.name
is 'Californication'
I want to just update the album name, however, my code is deleting all the other parts of album
and just leaving the album.name
. Can anyone advise how to do this properly?
Upvotes: 2
Views: 723