adding to array using reach hooks code example Example: adding to array using reach hooks setMyArray(oldArray => [...oldArray, newElement]);