Home > OS >  Use react-query with TypeScript
Use react-query with TypeScript

Time:11-18

I am trying to use react-query with TypeScript and providing the result of a request with a ts interface. Now I have the following problem

enter image description here

The value from "data" is this enter image description here

But I can't access it, because I specified the result in an interface enter image description here

  • Edit: I forgot to add the hook and interface.

enter image description here

enter image description here

CodePudding user response:

Ok, I fixed it. Added this to the fetchUser function, Now it will return only the data and not the whole request.

  • Related