I'm currently using Next.js and TypeScript and I'm confused on the error message I'm getting here. Here's some context to the situation. I'm making an API call and I'm receiving an Object of arrays.
const fetchDogBreeds = async () => {
const res: any = await axios.get("https://dog.ceo/api/breeds/list/all");
const data: any = res.data.message;
setDogBreeds(
Object.entries(data).map(
(breed:any) => breed[0].charAt(0).toUpperCase() + breed[0].substring(1)
)
);
};
The code runs fine but I'm getting this TypeScript Error and I don't understand what it means. Error:
Argument of type 'string[]' is not assignable to parameter of type 'SetStateAction<never[]>'.
Type 'string[]' is not assignable to type 'never[]'.
I'm a little new to TypeScript so I'm a little confused how to get this error to go away. Thanks in advance!
setDogBreeds; if it's correct, then how it is defined?