Skip to content

React query with react hook form #4844

Answered by louis-young
Walber10 asked this question in General
Discussion options

You must be logged in to vote

Hi 👋

Hey guys I have a query that gets a user by email when the form is submitted
should I use useState to handle this?

TanStack Query manages asynchronous state for you. If you need to derive state from the state of the query then you can, although it's usually better avoided.

I also have queries which depend of another query

You can express dependent queries with the enabled option. Please see: https://tanstack.com/query/v4/docs/react/guides/dependent-queries

Also, it looks like you might be using a query to perform a mutation (signing in), although it's hard to reason about your implementation given the unformatted example and lack of context.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Walber10
Comment options

@louis-young
Comment options

Answer selected by louis-young
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants