how to add objects to an array with use state code example Example: usestate array push setTheArray([...theArray, newElement]);