DEV Community

Discussion on: React + Typescript === "headache"

Collapse
 
redbar0n profile image
Magne • Edited

Try extracting the data fetching into a custom hook, for reusability, like shown in here in Approach A: dev.to/suhanw/decouple-data-from-u...

It is essentially what React Query does for you, which I would consider to look into vs Axios. That might reduce the boilerplate code considerably.

PS: The example would have been nice with a non-typescript version of the code, side-by-side. So we can see what headache came because of TypeScript vs. what came because of Axios.