Vue.js Advanced Data Provider Component Patterns Explained

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024

ความคิดเห็น • 47

  • @ProgramWithErik
    @ProgramWithErik  2 ปีที่แล้ว +7

    vuejsnation.com/
    The first 100% FREE Vue.js Conference is around the corner! 🎉
    Join the @vuejsnation and explore the vast @vuejs ecosystem in 2022!
    Date: 26th & 27th January
    Tickets: FREE ✅
    Interact with industry leaders LIVE including Evan You and Sebastien Chopin!

    • @MartinOmander
      @MartinOmander 2 ปีที่แล้ว

      I had not heard of this conference before. Thanks for bringing it up in your video, Erik!

    • @cnikolov
      @cnikolov 2 ปีที่แล้ว

      See you there

    • @Microphunktv-jb3kj
      @Microphunktv-jb3kj ปีที่แล้ว

      internal data provider like this ive seen in vue3 ui libraries, like naiveui and elementplus i think.
      "config provider" , the concept is the same i guess?

  • @abdallahalsahhar9511
    @abdallahalsahhar9511 2 ปีที่แล้ว +1

    about a week ago spent a day trying to do renderless script setup with no success, Thanks a lot @Erik

  • @gideaoferreira8236
    @gideaoferreira8236 4 หลายเดือนก่อน

    You are amazing, Erik. Thanks!

  • @MrSanya789
    @MrSanya789 2 ปีที่แล้ว +4

    Hi Erick, thanks for the video. I used this pattern a lot on my current Vue 2 project and find it very useful. I always write it with template section like this:
    As for me, it is a bit simpler than context usage.

    • @MartinOmander
      @MartinOmander 2 ปีที่แล้ว +1

      That's an elegant way of doing it. Thanks for sharing!

    • @ProgramWithErik
      @ProgramWithErik  2 ปีที่แล้ว +1

      Nice!

  • @kaibe5241
    @kaibe5241 2 ปีที่แล้ว +4

    Pretty interesting way of managing data requests, but I think I'll stick to my domain repositories.

  • @norielarguelles110
    @norielarguelles110 2 ปีที่แล้ว

    nice vid Erik!

  • @cnikolov
    @cnikolov 2 ปีที่แล้ว +1

    Use fetch and the Utility lib looks very good, I would still wrap it to composable or something so I can use typescript to marry the types

  • @DarylLegion
    @DarylLegion 2 ปีที่แล้ว

    Thanks Erik!

  • @chris_ea
    @chris_ea 2 ปีที่แล้ว

    🏆 absolutely useable!!!!

  • @andrewananenko797
    @andrewananenko797 2 ปีที่แล้ว +1

    Maybe i am wrong, but why use this way if we have with default slot and #fallback for loading indicator? does the same but greatly easier. Thank you for the video!

  • @andrewananenko797
    @andrewananenko797 2 ปีที่แล้ว

    Sorry for question, What do you constantly try to look for aside?

  • @binodnepali
    @binodnepali 2 ปีที่แล้ว

    Hey Erik, do you have a video about your VIM setup in VS code?

  • @dmitriykret8938
    @dmitriykret8938 2 ปีที่แล้ว

    so helpful 👍

  • @Technologism
    @Technologism ปีที่แล้ว

    What theme or extension do you use to make the function name so bright

  • @JanisWalliser
    @JanisWalliser 2 ปีที่แล้ว +1

    Not so sure if I would call a component that literally uses the render function to render a slot "render less". Maybe I am missing something tho.
    Also one point not mentioned which I think counts for the composable way is that it is usable outside of Vue. E.g. in a App that is not Vue only you can still use that composable function just without reactivity.

    • @ProgramWithErik
      @ProgramWithErik  2 ปีที่แล้ว +1

      Well, it's rendering a slot, which I feel like is enough to call it renderless. I Adam Wathan coined it, in his Advanced Vue course. Interesting, I haven't though of that definition of composable.

  • @MilenkoCurcin
    @MilenkoCurcin 2 ปีที่แล้ว

    Can you also create an example with posting data instead of fetching? A great video, btw

  • @Shmidtelson
    @Shmidtelson 2 ปีที่แล้ว

    Bro why are you using any type with props?

  • @josehermosillarodrigo1795
    @josehermosillarodrigo1795 2 ปีที่แล้ว +2

    Why don't you just use a template tag to render the default slot and bind data? I think it's easily to work with, instead of dealing with render functions. Something like:

    • @ProgramWithErik
      @ProgramWithErik  2 ปีที่แล้ว

      I used a renderless function witha v-slot. I then did it without the template tags. Look at 07:02

  • @MartinOmander
    @MartinOmander 2 ปีที่แล้ว

    I appreciate seeing a new way of calling APIs. But why do extra work to put the fetch code in a component, instead of simply importing a util file which exports a plain old function? I'm genuinely curious.

    • @blank4157
      @blank4157 2 ปีที่แล้ว +1

      I think he used it for the sake of explaining the concept i.e renderless components.
      I would still prefer plain old functions for api calls (I usually call them services) since they can be used anywhere in your js code and not just inside templates.

    • @MartinOmander
      @MartinOmander 2 ปีที่แล้ว +2

      @@blank4157 Good point!
      I did some more online searching of why one might want to put code in renderless components, as this was a mystery to me. Some people say that renderless components are easier for UI developers to use. A Javascript developer would implement the component. Then a UI developer can add it to layouts by simply adding tags. Presumably they are more comfortable with HTML-like tags than with raw Javascript code.
      As I am more of a Javascript developer and less of a UI developer, it could be that this technique simply isn't aimed at people like me.

    • @ProgramWithErik
      @ProgramWithErik  2 ปีที่แล้ว +1

      Great points already in the comments here, but as I said in the video, it could also be that you'd like to use the full power of Vue, and be able to Reactive variables, and lifecycle hooks and everything Vue has to offer. So wrapping it in a component makes sense.
      Being good for designers is another good point.

    • @MartinOmander
      @MartinOmander 2 ปีที่แล้ว

      @@ProgramWithErik What you said about using reactive variables and lifecycle hooks makes sense. Thanks for the clarification!

  • @chris_ea
    @chris_ea 2 ปีที่แล้ว

    Can you show a example by using axios instead of fetch?

  • @emmyleke7049
    @emmyleke7049 2 ปีที่แล้ว

    Hi Erik, what text extension do you use on VSCode that makes your arrow functions look like arrows.

    • @JesusMRamosPerez
      @JesusMRamosPerez ปีที่แล้ว

      I believe that is firacode font. I have been using it for a while and it looks great.

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว

      Any ligature compatible font will do, JetBrains Mono is by far my favorite.

  • @rajikkali2381
    @rajikkali2381 2 ปีที่แล้ว +2

    I prefer managing it all in Vuex

    • @MartinOmander
      @MartinOmander 2 ปีที่แล้ว

      Me too. Then any component can access the data that was fetched from the server.

  • @volodymyrkozliuk6811
    @volodymyrkozliuk6811 ปีที่แล้ว

    I really like your brackets theme. What is it called?😀

  • @brokula1312
    @brokula1312 2 ปีที่แล้ว +2

    It's more of a hack than useful tool. Greatest drawback is that you are pushing the logic inside the template and by using slots you loose type safety....so rather just use plain ol' composition API.

    • @ProgramWithErik
      @ProgramWithErik  2 ปีที่แล้ว

      That's why I showed both ways, so it is good to compare and contrast.

  • @glowiever
    @glowiever 2 ปีที่แล้ว

    this is like contextprovider in react

  • @ignisAnimus
    @ignisAnimus 2 ปีที่แล้ว

    Nice idea, but I wouldn't do it that way.

  • @richardstiller9492
    @richardstiller9492 2 ปีที่แล้ว

    Vue has good concepts, if it avoid its vue files, it will be useful.