I have
const abc = {
main: {
primary: 'initialPrimary',
},
buttons: {
text: 'initialText',
},
}
const updateAbc = (node, key, value) => {
return {updated abc}
}
So, if I call updateAbc('main','primary','updatedPrimary')
, it should return updated abc object
{
main: {
primary: 'updatedPrimary',
},
buttons: {
text: 'initialText',
},
}
or when called updateAbc('buttons','text','updatedText')
, it should return updated abc object with values
{
main: {
primary: 'initialPrimary',
},
buttons: {
text: 'updatedText',
},
}
It should update only for the value passed. How can it be done in es6?