tRPCttRPC
Powered by
venegoV
tRPC•10mo ago•
12 replies
venego

How do I fetch data conditionally?

Sorry if this is a stupid question.
I know that there is the
mutation
mutation
queries to do some actions and
queries
queries
for getting data.
I need to get data conditionally, I don't need to get a certain data but only on some specific event, I don't know if there's an option for that like the
useMutation
useMutation
and
useQuery
useQuery
.
I've tried
fetch
fetch
, but it seems like I don't use the right client configuration?
   const trpcContext = trpc.useContext();
   const translateSelected = await trpcContext.interactiveSubs.fetch(...)
   const translateSelected2 = await trpc.interactiveSubs.fetch(...)
   const trpcContext = trpc.useContext();
   const translateSelected = await trpcContext.interactiveSubs.fetch(...)
   const translateSelected2 = await trpc.interactiveSubs.fetch(...)
image.png
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

conditionally fetching data with a useQuery
PeformPPeform / ❓-help
2y ago
How do I exclude properties while returning data?
nightspiteNnightspite / ❓-help
2y ago
useQuery hook modify data on fetch.
MajMMaj / ❓-help
3y ago