You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a custom hook that takes in multiple auto-generated query hooks and mutation hooks to reduce duplicate code in my codebase but I'm having a hard time writing a generic function type for the auto-generated client code. I looked through the documentation and didn't see any Generic types defined for the auto-generated clients. For context, my custom hook that takes in the query/mutation hooks is just doing basic CRUD operations required for one of my React components. I could abstract this into functions that are just used as the onSuccess/onMutate callbacks of the generated hooks instead of a custom hook. I am looking type definitions or for advice on how people are solving this code duplication issue.
Here was my first attempt at trying to create Generic types for the Kubb TypeScrpit read/mutate hooks
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm trying to write a custom hook that takes in multiple auto-generated query hooks and mutation hooks to reduce duplicate code in my codebase but I'm having a hard time writing a generic function type for the auto-generated client code. I looked through the documentation and didn't see any Generic types defined for the auto-generated clients. For context, my custom hook that takes in the query/mutation hooks is just doing basic CRUD operations required for one of my React components. I could abstract this into functions that are just used as the onSuccess/onMutate callbacks of the generated hooks instead of a custom hook. I am looking type definitions or for advice on how people are solving this code duplication issue.
Here was my first attempt at trying to create Generic types for the Kubb TypeScrpit read/mutate hooks
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions