You are using useFetch WRONG! (I hope you don't)
Alexander Lichter
0:00 / 0:00
You are using useFetch WRONG! (I hope you don't)
52 421 просмотр · 2 года назад
Alexander Lichter
18 тыс. подписчиков
52 421 просмотр · 2 года назад
💪🏻 useFetch is a mighty composable to fetch data in your Nuxt.js application. It can do so many things, from updating state to refreshing calls easily and even data caching is possible. But often I see that people misuse useFetch because it is so tempting to use all the features, even when you shouldn't. In this video I show the most common mistake with useFetch and what to use instead!
Key points:
🤔 A demo application with a common mistake - can you spot it before?
✅ How to fix the bug
2️⃣ Approaches to avoid that useFetch mistake
Links:
📺 Is your function really a composable? • Is your function REALLY a Vue composable?
🔗 ofetch ($fetch in Nuxt): https://github.com/unjs/ofetch
🔗 useFetch docs: https://v3.nuxtjs.org/examples/compos...
Don't forget to hit that "Subscribe" button, ring the notification bell and give a thumbs up!
🌐 Connect further:
Website: https://www.lichter.io
Twitter/X: / thealexlichter
Twitch: / thealexlichter
Chapters:
00:00 Intro
00:50 Demo application overview
01:51 Submitting the form
02:14 The issue pops up
02:40 Explaining the issue
04:42 First solution
06:21 How the issue is caused
07:43 Second solution
09:44 My rule of thumb
10:29 Outro