You're Probably Using Nuxt Wrong

You're Probably Using Nuxt Wrong

LearnVue

4 недели назад

10,700 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@nested9301
@nested9301 - 01.05.2024 00:36

I just use await useFetch without lazy: true and use the loading bar at the top like most websites do 😶

Ответить
@tolgabeyazoglu536
@tolgabeyazoglu536 - 27.04.2024 14:57

very fast transition screen and is it possible to slow down your narration

Ответить
@EnnioVisconti
@EnnioVisconti - 26.04.2024 14:34

Thanks for the video, it's so clarifying! I just want to point out that the Nuxt Team already realized that the `lazy: true` is the best option, and in fact they provide a `useLazyFetch` composable that is exactly syntactic sugar for that purpose.

Ответить
@svenst
@svenst - 25.04.2024 10:36

Mh .. still not clear to me, do we need to add the await or not?

Ответить
@jaker9007
@jaker9007 - 25.04.2024 09:28

I have been using $fetch exclusively in cases when fetching is triggered by user actions, inside functions. But can we avoid using $fetch altogether by passing proper options to useFetch?

Ответить
@wertin200
@wertin200 - 25.04.2024 02:56

Great video, it explains a lot!

Ответить
@what1heh3ck
@what1heh3ck - 25.04.2024 02:01

I’m still confused. Does “await” matter?

Ответить
@mahsamrz5787
@mahsamrz5787 - 25.04.2024 01:24

Hi, how about using, useFetch without await and lazy like this: useLazyFetch ?

Ответить
@virtuoz-ru
@virtuoz-ru - 24.04.2024 23:42

👍

Ответить
@s4ndeep1203
@s4ndeep1203 - 24.04.2024 21:17

thank you for explaining this

Ответить
@Nerlon93
@Nerlon93 - 24.04.2024 20:33

Ok. Now the same but with some real dummy-app example not just abstractive theory pls! It's much easier to understand the abstraction if you have some peaches and apples to visualise those technical aspects :)

Ответить
@Codethier
@Codethier - 24.04.2024 19:37

bit salty you just posted this, i kind of spent the last week coming to the same conclusion 😶😶

Ответить
@iUmerFarooq
@iUmerFarooq - 24.04.2024 19:23

Need more Vuejs and Nuxtjs content 💚

Ответить
@dqrk0
@dqrk0 - 24.04.2024 19:12

worst thing about nuxt is the lack of documentation, so you get into situations like this where you have to read through the source code to understand what these functions do

Ответить
@amardeepgill3213
@amardeepgill3213 - 24.04.2024 19:12

the pending ref is deprecated ;) best to use status

Ответить
@mohammedzaid6634
@mohammedzaid6634 - 24.04.2024 18:47

great video
i was confused about this for a while
now i understand it

THANK YOU! KEEP GOING!

Ответить
@OldenDays
@OldenDays - 24.04.2024 18:37

the most confusing topic in Nuxt, finally well explained. thanks

Ответить
@RaphaelDDL
@RaphaelDDL - 24.04.2024 18:17

Thank you for the explanation.

Nuxt2 was easier to understand in that matter, I think.

You either used fetch() (and $fetchState.pending etc) for data fetch which doesn't block client navigation (and you have to assign the value to your data via this.datavar = yourfetchvalue) , or asyncData() for navigation blocking (and you directly return the data you want that will be used in the template, without need to assign to a data). As far as I remember, that was it.

Now in 3 is confusing by having useFetch, useAsyncData, $fetch.. which in the end is all the same method, but it doesn't block because you can give lazy true.

Ответить
@CapitaineToinon
@CapitaineToinon - 24.04.2024 18:14

Yeah that's the sort of things about nuxt I really dislike. I used Remix for a while and the data fetching model there is so much easier to understand imo. Also, maybe it's a skill issue but I've not been able to keep my nuxt pages type safe when using useAsyncData + throw createError(404) utils. Afaik that's a vue limitation but type narrowing not being propagated from script to template is annoying as hell.

Ответить
@pratikrane149
@pratikrane149 - 24.04.2024 18:08

Timely video! Currently migrating a project from Vue2 to Nuxt3 and I did struggle to know which composable to use where.

Thanks for an easy explanation of such a complex topic. Always love this clean demonstrating videos! ✨

Ответить
@orenmizr
@orenmizr - 24.04.2024 16:52

great content! 10x matt .

Ответить
@danialwafiy5978
@danialwafiy5978 - 24.04.2024 16:48

Hi, on a side note, does using server:false mean it wont get rendered on the server hence no SEO ? because for me what I do now is if I want the content data to NOT BE "SEOABLE", I'll set server:false, else I'll just use default. Not sure if this is the right concept.

Ответить
@yourivanmill
@yourivanmill - 24.04.2024 16:40

This feels so weird, because if you await a component the parent should be Suspend. So this is kinda a "hack"?

Why did Nuxt not let the user use "normal" onServerPrefetch" hook?

Ответить
@universe_decoded797
@universe_decoded797 - 24.04.2024 16:32

We should keep it simple, simplicity makes working with a framework nice.

Ответить
@blokche_dev
@blokche_dev - 24.04.2024 15:55

Nuxt is flexible. But damn! it's not always obvious to know which tool to use and when :/

Ответить
@TilenPirih
@TilenPirih - 24.04.2024 15:52

Is there also any trick when you need to pass authorization header for example? what would be the best solution in that case? do we create our own instance of useFetch, is it possible to set some global header somewhere in the config? What do you recommend?

Typical example when you have to login and then get some items.

Ответить
@user-od1mt8qr8y
@user-od1mt8qr8y - 24.04.2024 15:40

I'm still confused. I definitely have to watch this video more than once. Thank you.

Ответить
@AksoomHussain7866
@AksoomHussain7866 - 24.04.2024 15:37

butter smooth explanation 🤩

Ответить
@shadkamel362
@shadkamel362 - 24.04.2024 15:35

This explains a lot for me, thank you

Ответить
@mohaab
@mohaab - 24.04.2024 15:29

Love this, thanks for the explanation!

Ответить
@OGJons
@OGJons - 24.04.2024 15:04

WE'RE SO BACK BABY

Ответить