I am trying to store data in my state. When I console log the data I get the correct data. When I store it in my state and console log it, I keep getting "c" in my console. Why is C being stored in my state when there is no sign of "c" in my entire code
This keeps giving me C in my console.
const getIds = async () => {
Axios.get(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1&sparkline=false"
).then((response) =>
response.data.map((res) => setCoinIds(...coinIds, res.id))
);
console.log(coinIds);
};
This logs the correct data:
const getIds = async () => {
Axios.get(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1&sparkline=false"
).then((response) => response.data.map((res) => console.log(res.id)));
};
Why is the data not stored in my state?