Optimistic Updates In React - The Best Way
How I handle optimistic updates in my React.js app and why I dislike the new useOptimistic hook.
⭐ Get my full-stack Next.js with Express & TypeScript course: codinginflow.com/nextjs
✅ Get my free React Best Practices course: www.codinginflow.com/reactbes...
💌 Join my newsletter for regular web dev tips: codinginflow.com/newsletter
💬 Join our developer community on Discord: codinginflow.com/discord
📣 Follow Coding in Flow on social media:
Twitter: / codinginflow
Instagram: / codinginflow
TikTok: / codinginflow
Facebook: / codinginflow
Пікірлер: 16
Get my FREE React Best Practices course: codinginflow.com/reactbestpractices
Interesting. Thanks!
Hi, I have a problem in Next.js. When users upload images and they are saved in /public/uploads, they are only accessible after running npm run build & npm start again. To solve this problem, you could set up a separate Express server that only handles uploads. A video tutorial on this would be great, as I have seen many people not knowing the best way to solve this issue. Thanks and best regards.
@codinginflow
12 күн бұрын
Usually people upload files to a storage bucket like S3
How about react-query?
@codinginflow
12 күн бұрын
Probably even better than SWR, but I have never used it
@Jibs-iq1em
12 күн бұрын
was about to ask the same, I used react query for something similar and it came through 😊
@CharcoalDaddyBBQ
12 күн бұрын
Love react query. Very clean and easy to read when checking bugs. Has all these features above.
Quick question will using SWR increase backend api calls ? Wont that be bad
@codinginflow
11 күн бұрын
Yes, revalidation requires API calls. You can disable it if you don't like it.
or you can use state mgmt :)
@codinginflow
12 күн бұрын
I'm not sure if that's the right solution here because this is remote state, not app state. SWR handles remote state for you.
@imakhlaqXD
11 күн бұрын
Soo if its remote so why are we not using simple state and when doing request we update the state and if somethings goes wrong then reset the update ???. Am i missing something??
@codinginflow
10 күн бұрын
@@imakhlaqXD Caching, revaliation, race conditions
why not react query
@codinginflow
11 күн бұрын
That's fine too