get all data from an array and add with use state code example Example: usestate array push setTheArray([...theArray, newElement]);