I have this object as a state in reactjs. I want to add another object inside the "childoptions: []" array which is nested inside the options array on button click.
How can I achieve this, pls help...
const [select1, setSelect1] = useState({
id: uuid(),
type: 'select',
properties: {
label: 'Select1',
options: [
// {
// id: uuid(),
// optionName: 'red ',
// value: '',
// childOptions: [],
// },
// {
// id: uuid(),
// optionName: 'green ',
// value: '',
// childOptions: [],
// },
// {
// id: uuid(),
// optionName: 'blue ',
// value: '',
// childOptions: [],
// },
],
},
parentId: null,
});