const [arr, setArr] = useState({
value: [],
});
//I want to append the value on the state object but its overwriting it.
setArr((prevState) => ({
...arr,
value: [...prevState.value, res.data],
}));
...arrwith...prevStateand you're golden.