how to create an array using useState in js code example Example: usestate array push setTheArray([...theArray, newElement]);