T
tRPC

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

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

Yyaviscoke5/26/2023
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 is empty string and is it possible to write condition when it should run request and when not, when search is empty I dont want to run request
Solution:
enabled: !!search
Jump to solution
Solution
AKAlex / KATT 🐱5/26/2023
enabled: !!search
Yyaviscoke5/26/2023
thankss

Looking for more? Join the community!

T
tRPC

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

Join Server