I have state set as follows:
const [groupState, setGroupState] = useState({
groupId: uuidv4(),
content: [],
});
I want to push an object to the 'content' array but am having difficulty. I looked at this answer: How do I update states onchange in an array of object in React Hooks but can't seem to apply it to the problem.
Currently I have:
setGroupState({
...groupState,
...content.push({test: 'test'})
});
.. but it's not working and I'm getting nowhere.
Can anyone tell me how to get this sorted?