react adding an array to useState in one call code example Example: usestate array push setTheArray([...theArray, newElement]);