Agregando a la matriz usando ganchos de alcance
setMyArray(oldArray => [...oldArray, newElement]);
Inexpensive Impala
setMyArray(oldArray => [...oldArray, newElement]);