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 below - this is passing in multiple arguments.
setHistory(...newHistory);