DEV Community

Discussion on: 🪝 Building custom "useTypedFetch" hook in React with TypeScript

Collapse
 
vovacodesca profile image
vova ushenko • Edited

Hey Daniel, thanks!

I think solutions with built-in caching are more preferable. Caching, arguably, is one of the most complicated parts in building software, so it’s pretty cool to delegate this responsibility to some library (managing and maintaining your own solution can be a nightmare).

I have no particular preference regarding libraries, but in the React world - React Query is gaining more and more popularity. Honestly, I have never used it in production, so I have no real opinion yet.

With Next.js, I could recommend useSWR which in tandem with static generation will result in a modern dynamic app which is kinda pre-generated on the server (best of both worlds).

Anyways, there is nothing wrong with fetch or axios. In my apps, I often use axios in tandem with redux and thunks (slightly different architecture than we discussed here).

Cheers!

Collapse
 
hedwardd profile image
Heath Daniel

That makes sense. I'll definitely be looking into React Query (and keeping an eye out for the others) now. Thanks!