seState hook nested state update 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);
}