how to add new items to an array in react using useState code example Example: usestate array push setTheArray([...theArray, newElement]);