DEV Community

Discussion on: DIY: Writing custom React Hooks to perform async operations

Collapse
 
hoverbaum profile image
Hendrik

Good stuff 👍

I think it's worth to point out that you can use the hook twice to fetch from multiple resources. By renaming the variables during destructuring of the hooks return you can even give your different resources speaking names instead of just data.

And by using generics you can even specify what type of data you are expecting to get back. typescriptlang.org/docs/handbook/g...