Justus
TTCTheo's Typesafe Cult
•Created by Justus on 7/27/2024 in #questions
NextJS `useOptimistic` vs. tRPC react-query optimistic update?
I'm using
1. NextJS app router
2. tRPC with react-query
I want to perform optimistic updates but I'm unsure which approach to use? I followed NextJS example first. The state updated correctly but jumped back to the initial one. Then I followed t3 documentation but I'm not sure if that is using pages or app router.
Does anyone have an example for using optimistic updates using t3-stack with app router and tRPC?
https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#optimistic-updates
https://create.t3.gg/en/usage/trpc#optimistic-updates
2 replies
TTCTheo's Typesafe Cult
•Created by Justus on 2/3/2024 in #questions
Use React Query + Fetch for file upload
Hey there, I'm using Cloudflare's presigned URL to upload files. To upload the file I'm using the fetch API. How can I use react query for that fetch action? React Query works seamlessly with trpc, but how can I make it work for a good old fetch or axios request?
I couldn't find a question like this before. If it does exist, please point me to the thread! Thanks everyone for your help in advance 🙏🙌
7 replies