Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Query hooks #1721

Open
vorlov opened this issue Feb 14, 2025 · 4 comments
Open

React Query hooks #1721

vorlov opened this issue Feb 14, 2025 · 4 comments
Labels
feature 🚀 New feature or request

Comments

@vorlov
Copy link

vorlov commented Feb 14, 2025

Description

is it possible to generate ready to use hooks instead of SDK methods, which are used in useQuery? for example useSomeEnpoint() from codegen?

@vorlov vorlov added the feature 🚀 New feature or request label Feb 14, 2025
@pnodet
Copy link

pnodet commented Feb 14, 2025

Not dev here but we've been using this with plugins/tanstack-query

If you haven't checked you should try, it's quite easy to use

@nikitastryuk
Copy link

nikitastryuk commented Feb 15, 2025

+1
Generating the entire useQuery(), useMutation(), ... calls is definitely a step forward for DX, reducing some boilerplate. After code generation, I always manually create useSomething hooks to keep consumers clean.

@amarant
Copy link

amarant commented Feb 21, 2025

Bad idea, even tRPC went back from providing custom hooks to only giving query options and query keys :

https://trpc.io/blog/introducing-tanstack-react-query-client

@mrlubos
Copy link
Member

mrlubos commented Feb 21, 2025

@amarant while I agree in principle (and hence it's designed the way it is), I do think giving people the option to create custom hooks would be a nice feature. Clearly, some people really want it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants