7 Vue Patterns That You Should Be Using More Often

Sdílet
Vložit
  • čas přidán 30. 01. 2021
  • Original article: / 7-vue-patterns-that-yo...
    Source code: github.com/lmiller1990/7-vue-...
    Ref sugar RFC: github.com/vuejs/rfcs/pull/228
    Script setup RFC: github.com/vuejs/rfcs/pull/227
    Follow Fotis: / fadamakis
    Me on Twitter: / lachlan19900
    📗 $5 off my Design Patterns for Vue.js with YT_5_OFF: lachlan-miller.me/design-patt...
  • Věda a technologie

Komentáře • 27

  • @residentk.8881
    @residentk.8881 Před 2 lety +5

    the provide/inject is one of the edge cases feature that not recommended to using in common cases according to vue docs

    • @LachlanMiller
      @LachlanMiller  Před 2 lety +1

      Sure, it definitely has a time and place though - mainly for things you need to be globally available, like the router and your Vuex/Pinia store. But I generally avoid using it, and tend to use props where I can.

    • @theseangle
      @theseangle Před rokem +1

      @@LachlanMiller imo when you're considering using provide/inject you can always use Pinia instead. Or composables.

  • @brahim_boussadjra
    @brahim_boussadjra Před 3 lety +4

    These awesome videos are like gems for me

  • @aroxing
    @aroxing Před 2 lety +1

    Thanks for the tutorial. I'm wondering about common patterns of ajax errors and spinner issues. Is there any general pattern to avoid code duplication? Or do I need to copy-paste spinner and error handling code every time I need to add a new AJax query? Maybe you share an example. Thanks in advance.

  • @adevin9155
    @adevin9155 Před 3 lety +2

    Thanks for yr videos

    • @LachlanMiller
      @LachlanMiller  Před 3 lety

      thanks for the comment - it means more than you think! it's super hard to get feedback, I appreciate it :D

  • @jaymartinez311
    @jaymartinez311 Před 2 lety +1

    I’ve bought all your courses and books. Is it posssible you can build a portfolio app? Where i can show my resume, links yo other projects, embed a todo app if possible etc… Like a all in one portfolio site. Thank you for the content. Either in the options or composition api. I learned how to convert from your me or the other.

    • @LachlanMiller
      @LachlanMiller  Před 2 lety +2

      Are you asking for a video tutorial on how to build a portfolio app? I think this would be definitely doable if you really internal all the content I've produced - I'd recommend you give it a try yourself, happy to take a look at some code if you get stuck.

  • @rickyu1978
    @rickyu1978 Před 3 lety +1

    How would you do loading state in the router.js file

    • @LachlanMiller
      @LachlanMiller  Před 3 lety

      Going to need some more info, if you can share a code-base and explain what you want I could make a video showing how to do it

  • @zergzerg4844
    @zergzerg4844 Před rokem

    I did't get it. In documentation specified than we have to import ref from vue, but i did't see such record in your coed. 4:56 What's the trick?

  • @vasiliyrusin
    @vasiliyrusin Před rokem +4

    I'm really not sure that provide/inject is a good technic that you should use, on our project (which we took from other developers) we tried to remove this pattern because of some troubles which it ships with. It is spaghetti code which I try to avoid for obvious reasons. I'm sure that it's helpful in some utility or magic things such as forms (maybe for validation purposes) but it really shouldn't be a thing that "you should use more often".

    • @LachlanMiller
      @LachlanMiller  Před rokem +1

      I agree, I do not use provide/inject outside of writing a third party plugin to throw on npm. I do not use provide/inject in regular apps.

    • @timmeehan2365
      @timmeehan2365 Před 6 měsíci

      It's actually a pretty useful technique to decouple your components from some implementation details like storage, data provider etc, similar to Providers in Angular or (kind of) Context in React.
      I agree the name receive is actually much more clear, but they probably used "inject" for dependency injection, which is what it's doing

  • @christiann7058
    @christiann7058 Před 3 lety +1

    Hi Lachlan, would You share the code base of the things You show in this video?

  • @user-bw3vr6qb7g
    @user-bw3vr6qb7g Před 3 lety +1

    Hi, can I translate the this article into Chinese and share it to more developers? I will write the original author and the address of the article.

    • @LachlanMiller
      @LachlanMiller  Před 3 lety

      Yes, absolutely!
      Please send me a link when you post it :)

  • @wobsoriano
    @wobsoriano Před rokem +1

    RIP Ref Sugar

  • @em9999999
    @em9999999 Před rokem

    Is that Comic Sans?

  • @wernerlang3115
    @wernerlang3115 Před 11 měsíci

    Thank you for taking away inject questionmark ! 🪡