how to add elements to an array in usestate hook code example Example: usestate array push setTheArray([...theArray, newElement]);