put array in usestate react code example Example: usestate array push setTheArray([...theArray, newElement]);