how to push the array in use state array code example
Example 1: React Hooks append state
setTheArray(currentArray => [...currentArray, newElement])
Example 2: add object to array react hook
setTheArray([...theArray, newElement]);
setTheArray(currentArray => [...currentArray, newElement])
setTheArray([...theArray, newElement]);