fetch

Need to fetch an endpoint on key stroke, how do you do that?
4 Replies
cje
cje15mo ago
is your question how to send a query imperatively rather than when the component mounts? if so, look at enabled and refetch here: https://tanstack.com/query/v4/docs/react/reference/useQuery
K1|ller
K1|llerOP15mo ago
thanks yeah I ended up doing it with a boolean and useEffect works good now using "fetch" didn't made sense so i was trying to find a way to do it the T3 way
cadams
cadams15mo ago
Go to know - you can also use useMutation to call an endpoint (tRPC router) - incase the enabled prop way in useQuery doesnt work
No description
K1|ller
K1|llerOP15mo ago
did something similar but with useQuery. I'm now trying to understand how pages work in next, i literally went from react/vite to T3 .. I knew some TS so I'm surviving lol
Want results from more Discord servers?
Add your server