Wow, I'm shocked there aren't any comments on this. I found this super interesting and helpful. I've always wanted a typed fetch but never got around to implementing one.
I'm curious, you mention that this is for academic purposes and you would recommend using "established solutions and libraries" in production. Can you give me an example of one of those?
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).
Wow, I'm shocked there aren't any comments on this. I found this super interesting and helpful. I've always wanted a typed fetch but never got around to implementing one.
I'm curious, you mention that this is for academic purposes and you would recommend using "established solutions and libraries" in production. Can you give me an example of one of those?
And great article btw. Thanks!
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!
That makes sense. I'll definitely be looking into React Query (and keeping an eye out for the others) now. Thanks!