#How to update array in app.tsx from a component.tsx?
3 messages · Page 1 of 1 (latest)
@zealous knot You'd have to put the array in state and expose some API to the child for updating it, something like:
const toggleExpanded = (id: number) => {
setValues(values.map(value => {
return value.id === id ? {
...value,
expanded: !value.expanded
} : value
}))
};
Will it be easier if I share the two codes I’m talking about? I am still not too sure about how to get it implemented.