TRPC onClick

What is the best way to call a TRPC client on a button click. looking to get data from TPRC
4 Replies
cje
cje14mo ago
disable the query and refetch on click
MrGreyKnight
MrGreyKnight14mo ago
Any chance you have an example or links to the right bit of the docs? and does that change with the T3 tRPC setup?
cje
cje14mo ago
const hello = api.example.hello.useQuery(
{ text: "from tRPC" },
{ enabled: false }
);

return <button onClick={() => void hello.refetch()}>Click me</button>;
const hello = api.example.hello.useQuery(
{ text: "from tRPC" },
{ enabled: false }
);

return <button onClick={() => void hello.refetch()}>Click me</button>;
the t3 trpc setup doesn't change anything its basically stock
MrGreyKnight
MrGreyKnight14mo ago
Thanks much appreciated!
Want results from more Discord servers?
Add your server
More Posts