A spread argument must either have a tuple type or be passed to a rest parameter React
To put this simply: Because you’re using the spread operator directly, you’re passing in multiple arguments to your useState function, but useState functions only accept a single argument. Instead, use the spread operator to create a single array, and pass that in. const newObject = […newHistory]; setHistory(newObject); // or, even simpler: setHistory([…newHistory]); // NOT the … Read more