push-metod-in react-hooks-usestate
const [theArray, setTheArray] = useState(initialArray);
setTheArray(theArray => [...theArray, newElement]);
Lovely Locust
const [theArray, setTheArray] = useState(initialArray);
setTheArray(theArray => [...theArray, newElement]);