venegoV
tRPC9mo ago
12 replies
venego

How do I fetch data conditionally?

Sorry if this is a stupid question.
I know that there is the
mutation
queries to do some actions and 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 and useQuery.
I've tried 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(...)
image.png
Was this page helpful?