I have an object as state in react:
{course: {…}, userIDs: Array(2), usersNumber: 2}
Where course
is such an object:
price : 100
promotion : null
comments : []
What I want to do is add a new object to the comments
array and leave all other properties unchanged. How to do it with useState
?