I made a request with AXIOS to the server and then the server returned the value as follows:
I want to save it in state, here I use react hooks, when I want to set state with data as shown I get error:
Argument of type '() => IterableIterator<IMahasiswa>' is not assignable to parameter of type 'SetStateAction<undefined>'.
Type 'IterableIterator<IMahasiswa>' is not assignable to type 'undefined'.ts(2345)
and this is my code:
and my interface:
how do I set the interface for setMahasiswa I have tried <IMahasiswa[]> but it gives the same error, except that in the res.values section it is replaced with res it is successfully returned, but it will throw another error when I using map for looping



<IMahasiswa[]>? Can you include that error message?