update each array of nested object react hook code example
Example 1: react hooks update nested object
<RadioButtonGroup
onChange={(event) => {
setStyle(prevStyle => ({
...prevStyle,
font: { ...prevStyle.font, align: event.target.value }
}));
console.log(style);
}}
/>
Example 2: react hooks update nested object
const onChange = (event) => {
const s = {...style};
s.font.align = event.target.value;
setStyle(s);
}