I have some confusion about using Object.assign for React and Redux.
I read this article.
It says ES6 Does not supported by all browsers but I
The alternative to the code you posted is using object spreading:
export const selectDiameter = (scaleData, size) => ({
type: SELECT_DIAMETER,
payload: {
...scaleData,
diameter: {
...scaleData.diameter,
selected_tube_diameter: size,
is_clicked: true,
audio: {
...scaleData.diameter.audio,
is_played:true
}
}
}
});
I have also shortened the body of the arrow function in your code to simply returning the object.
You can use the object rest spread syntax by using the Babel plugin transform-object-rest-spread.
Install it like this:
npm install --save-dev babel-plugin-transform-object-rest-spread
Configure its use in your .babelrc like this:
{
"plugins": ["transform-object-rest-spread"]
}