You're Probably Using Nuxt Wrong

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 80

  • @svenst
    @svenst 8 місяців тому +29

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

  • @iUmerFarooq
    @iUmerFarooq 8 місяців тому +53

    Need more Vuejs and Nuxtjs content 💚

  • @yoskokleng3658
    @yoskokleng3658 3 місяці тому +5

    I'm still confused. so for SPA which one i should use?

  • @OldenDays
    @OldenDays 9 місяців тому +14

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

  • @dqrk0
    @dqrk0 8 місяців тому +53

    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

    • @najlepszyinformatyk1661
      @najlepszyinformatyk1661 8 місяців тому +3

      nuxt sucks because of this.

    • @Microphunktv-jb3kj
      @Microphunktv-jb3kj 8 місяців тому

      @@najlepszyinformatyk1661 makes you think they intentionally do bad docs... so they can sell their courses and certificate wich seems a thing now.... i think everyone would laugh in Estonia.. i would t try to get hired saying i have a "nuxt certificate" , would be seen as stupid tax.

    • @codybontecou
      @codybontecou 8 місяців тому +13

      The deeper you get into open-source libraries, the more you realize every library has this issue. Learning to read source and auto-generated documentation is key to mastering these tools.

    • @theseangle
      @theseangle 8 місяців тому

      Nuxt 2 gave me a horrible impression of Nuxt, so horrendous I just don't touch Nuxt nowadays. There was no human readable documentation, no typing, too much forced magical globals, string to symbol magic (even into global symbols), no proper informative errors, impossible migration/updates, very slow development of Nuxt 3 and the bridging methods, errors happening from absolutely nothing for zero reasons (that are non-documented and impossible to track down), very slow hot module replacement and a whole lot of other things that made me lose so much sleep and gave me gray hair.
      Just think about it: forced global variables, that have absolutely zero typing/type-hinting. Never fails to be a ground for eventual impossible to track down runtime errors. Forcing you into re-typing everything manually via .d.ts into global scope. Again, unmaintainable, unreliable and evil, because human factor.
      At least they have typing now

    • @quintencabo
      @quintencabo 8 місяців тому +6

      Idk what your talking about the docs are great now

  • @pratikrane149
    @pratikrane149 9 місяців тому +4

    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! ✨

  • @TranJames-b5v
    @TranJames-b5v 8 місяців тому +4

    Sorry but It's still doesn't clear to me, if its client side fetching then I think await is not needed, and it wont block navigation when its client side

  • @MrXQ-n3y
    @MrXQ-n3y 9 місяців тому +12

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

    • @LearnVue
      @LearnVue  9 місяців тому +1

      yeah it's a pretty dense topic. let me know if you have questions

  • @RaphaelDDL
    @RaphaelDDL 9 місяців тому +3

    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.

  • @namaefumei
    @namaefumei 4 місяці тому +2

    Thanks for the great explanation
    Btw pending is deprecated, it is now status

  • @danialwafiy1014
    @danialwafiy1014 9 місяців тому +1

    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.

    • @LearnVue
      @LearnVue  9 місяців тому +2

      it won't render on the server, but tbh it's still unclear if/how/when Google renders JS client-side. If you want to be sure it won't be indexed, useSeoMeta is probably your best bet

    • @TheAlexLichter
      @TheAlexLichter 8 місяців тому +1

      It is "probably" still indexed by Google *but* SEO would be better when rendering it on the server. Not even starting to talk about OG tags which aren't available otherwise (if they rely on the data)

  • @what1heh3ck
    @what1heh3ck 8 місяців тому +4

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

    • @nishantrai982
      @nishantrai982 8 місяців тому +1

      yes. For data to be accessible (not be a promise) in the script setup.

    • @div0ky
      @div0ky 7 місяців тому

      @@nishantrai982 Thanks! I listened to the video in the background and missed this key detail.

  • @AdarshMadrecha
    @AdarshMadrecha 5 місяців тому

    This really clarifies things. Nuxt team should add link to this video in their docs.

  • @St0rMsk
    @St0rMsk 6 місяців тому

    Why is server side navigation / initial request blocked when using useLazyFetch / useLazyAsyncData?

  • @OGJons
    @OGJons 9 місяців тому +30

    WE'RE SO BACK BABY

    • @LearnVue
      @LearnVue  9 місяців тому +7

      back like i never left 🫡

  • @designerjehovah4453
    @designerjehovah4453 2 місяці тому

    I'd say I got it -ish. I still don't understand what behavior exactly is impacted whether or not we await useAsyncData/useFetch. Could you elaborate more on that?

  • @universe_decoded797
    @universe_decoded797 9 місяців тому +1

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

  • @khaledoghli3400
    @khaledoghli3400 7 місяців тому +1

    When using nuxt , do i need to use Axios and set global interceptors !?

    • @rogercruz1547
      @rogercruz1547 2 місяці тому

      They used to create repositories with axios, now I just make a service class which every method is a composable "useFetch"-like which in turn uses a custom plugin that auths to my api and has the base url read from .env
      So no axios here

  • @floydferdussonmejias9063
    @floydferdussonmejias9063 3 місяці тому

    what's the font ur using?

  • @jaker9007
    @jaker9007 8 місяців тому

    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?

  • @Bawaromerali
    @Bawaromerali 6 місяців тому

    thanks for this great video, it will be much better if u provide some examples and code with pinia and ssr cuz still i am confusing how to use pinia and requests on ssr

  • @amardeepgill3213
    @amardeepgill3213 8 місяців тому +2

    the pending ref is deprecated ;) best to use status

  • @TilenPirih
    @TilenPirih 9 місяців тому +2

    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.

    • @notlekrut
      @notlekrut 9 місяців тому +2

      I follow the example in the documentation - "Use Custom Fetch Composable" - it's basically a wrapper around the use fetch with default request options. You can use the functions onResponse and onRequest in the options to change both the response and request respectively. Or just set the headers field, either from runtimeConfig if it's an app config, or from another composable if it's a user auth header for example

    • @LearnVue
      @LearnVue  9 місяців тому +2

      Alexander Lichter dropped a banger video that could be helpful here - ua-cam.com/video/jXH8Tr-exhI/v-deo.htmlsi=RMZ23k-Vkwbqi6y9

    • @TilenPirih
      @TilenPirih 8 місяців тому

      In one project I created my own instance under composables and use that instance to pass data.

  • @khakcsar
    @khakcsar 8 місяців тому

    Thanks for explaining it in such an easy way.

  • @mohaab
    @mohaab 9 місяців тому +1

    Love this, thanks for the explanation!

    • @LearnVue
      @LearnVue  9 місяців тому

      glad it was helpful

  • @yourivanmill
    @yourivanmill 9 місяців тому

    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?

    • @LearnVue
      @LearnVue  9 місяців тому

      the component will suspend with await, using lazy is a way to opt out of it client side
      i think it’s really nice to have the same code for both ssr and client, but the specifics of all the options can get confusing.

  • @tolgabeyazoglu536
    @tolgabeyazoglu536 8 місяців тому +2

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

    • @hyno
      @hyno 8 місяців тому

      Use ( Shift + < )

  • @shadkamel362
    @shadkamel362 9 місяців тому

    This explains a lot for me, thank you

    • @LearnVue
      @LearnVue  9 місяців тому

      appreciate u fr

  • @Nerlon93
    @Nerlon93 8 місяців тому

    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 :)

  • @Slotherinee
    @Slotherinee 7 місяців тому

    Guys, could anyone tell me which font and theme author uses?

    • @KaiMacmaster
      @KaiMacmaster 4 місяці тому

      Looks like it could be operator mono

  • @AksoomHussain7866
    @AksoomHussain7866 9 місяців тому

    butter smooth explanation 🤩

    • @LearnVue
      @LearnVue  9 місяців тому

      glad you think so :)

  • @blokche_dev
    @blokche_dev 9 місяців тому +1

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

    • @dlodeprojuicer
      @dlodeprojuicer 9 місяців тому

      So true!!

    • @LearnVue
      @LearnVue  9 місяців тому

      any specific tools youre thinking of? im always down to make some more vids !

    • @blokche_dev
      @blokche_dev 9 місяців тому

      ​@@LearnVue I had to spend some time to figure out what was called on the server, what was not for example. Correct me if I'm wrong, but as I understand, server components (still experimental) are actually the only way to have secure logic inside components. Otherwise you have to use the server part and make api calls (where the first render may be safe and made on the server but all subsequent calls are made client side).

    • @TheAlexLichter
      @TheAlexLichter 8 місяців тому +1

      @@blokche_dev Correct

  • @wertin200
    @wertin200 8 місяців тому

    Great video, it explains a lot!

  • @mohammedzaid6634
    @mohammedzaid6634 8 місяців тому

    great video
    i was confused about this for a while
    now i understand it
    THANK YOU! KEEP GOING!

  • @olatunjiolakunle6908
    @olatunjiolakunle6908 7 місяців тому

    Powerful explanation

  • @s4ndeep1203
    @s4ndeep1203 8 місяців тому

    thank you for explaining this

  • @orenmizr
    @orenmizr 9 місяців тому

    great content! 10x matt .

  • @Niki2k1
    @Niki2k1 5 місяців тому

    Thank you so much awesome video

  • @Tarabass
    @Tarabass 8 місяців тому

    And useLazyFetch? :P

  • @Codethier
    @Codethier 8 місяців тому

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

  • @Yusran_Uca
    @Yusran_Uca 5 місяців тому

    Function vs V -

  • @виртуоз_ру
    @виртуоз_ру 8 місяців тому

    👍