tRPCttRPC
Powered by
yaviscokeY
tRPC•3y ago•
3 replies
yaviscoke

How to not send request in specific condition in useQuery()

  const { data: artists, isLoading } = api.findArtist.useQuery({
    name: search,
  });
  const { data: artists, isLoading } = api.findArtist.useQuery({
    name: search,
  });


I have this in my code so in beginning
search
search
is empty string and is it possible to write condition when it should run request and when not, when
search
search
is empty I dont want to run request
Solution
enabled: !!search
enabled: !!search
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

how can i send a request to specific route in trpc server, after mutation ?
kumard3Kkumard3 / ❓-help
3y ago
`useQuery` not working?
SansPapyrus683SSansPapyrus683 / ❓-help
3y ago