I will receive the response from Axios success.
In this response, I want to save into 2 different constants with normal data and reversed data.
but while I put console both are showing the reversed ones.
how can I achieve this?
slice().reverse() also returning the same array
const [psresponse, setPSresponse] = React.useState("");
const [trackresponse, setTrackresponse] = React.useState("");
axios.get(serverurl)
.then(function(response) {
var data = =response.data;
var reverseddata = data.slice().reverse();
setPSresponse(reverseddata);
setTrackresponse(data);
console.log(reverseddata)
console.log(response.data)
});
I want the normal array and the reversed array.
anyone has an idea pls let me know.