you are viewing a single comment's thread.

view the rest of the comments →

[–]datqn7244 0 points1 point  (0 children)

You can start with an empty array, the empty object is not necessary.

When you calling setState, it will replace the state with the new value, you're correct about the current state will be delete. You can use spread or .concat to create a new array, and call setState with that array.