add array of object to state react code example Example: add array of object to state react setTheArray(currentArray => [...currentArray, newElement])