Answers for "react hooks update nested object"

1

react hooks update nested object

<RadioButtonGroup
  onChange={(event) => { 
    setStyle(prevStyle => ({
        ...prevStyle,
        font: { ...prevStyle.font, align: event.target.value }
    }));
    console.log(style);
  }}
/>
Posted by: Guest on January-04-2021
0

react hooks update nested object

const onChange = (event) => {
    const s = {...style};
    s.font.align = event.target.value;
    setStyle(s);
}
Posted by: Guest on January-04-2021

Code answers related to "react hooks update nested object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language