Only query when value is not null?
I have a function that returns a useQuery object:
which is being used in the following functional component (Next.js):
However,
How do I solve this? I can't just wrap an if-statement around it as the
I tried adding
which is being used in the following functional component (Next.js):
However,
getSubmissions(currentProject) triggers the request even when currentProject is null.How do I solve this? I can't just wrap an if-statement around it as the
useEffect is dependend on isSuccess & data.I tried adding
if (!currentProject) return <LoadingCard />; above it but this causes rendering issues.