Understanding Vue 3's "expose"

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 20

  • @VueMastery
    @VueMastery  2 роки тому +7

    ⚡ You can access the written tutorial for free here: buff.ly/3JP0jI7

  • @anj000
    @anj000 2 роки тому +3

    Not gona lie, the last part flew over my head. Never seen render function used.

    • @alwaisy
      @alwaisy Рік тому

      same bro. but render h function mostly used in functional components in vue

  • @jocabin1518
    @jocabin1518 2 роки тому +1

    What theme do you use ?

  • @vladshepeluk7442
    @vladshepeluk7442 2 роки тому

    Hi! Great tutorial thanks, I have a question related to syntaxes, how can I access expose in that case?

  • @muslim2k
    @muslim2k 2 роки тому +3

    When you are making an opensource lib, why would you want that method to be private? Why not allow the users to call whatever method they want, just a questions if somebody can answer

    • @underscoreseanohue
      @underscoreseanohue 2 роки тому +5

      You might want to have the method be used internally by the component, and especially if the component is still being developed, the API might change (for example changing the parameters or return-value).
      If an end-user builds their app to rely on an internally-used method which then breaks because it should have been private, there is a problem).

    • @justafreak15able
      @justafreak15able 2 роки тому +4

      Exposing everything and calling it a day isn't always a good idea.

  • @derjansan9564
    @derjansan9564 2 роки тому

    Very good video. Do you know if using "expose" allows the private methods to be minified/uglified by the bundler?

  • @Sun0fABeach
    @Sun0fABeach 2 роки тому +2

    I would have preferred if she stressed that calling child methods by the parent is a huge antipattern. Never do this, unless can't think of an idiomatic way to do it otherwise, because it breaks the props down / events up contract between parent / child. I'd love the child methods to be private by default, only being explicitly exposable, but that would break backward compatibility.

  • @CZiNTrPT
    @CZiNTrPT 2 роки тому +1

    So how do I expose every method with `h()` without writing all of them out explicitly in `context.expose(..)`

  • @rsoaresmga
    @rsoaresmga 2 роки тому +1

    Perfect! 👏

  • @warrior_dev
    @warrior_dev 2 роки тому

    thank you very much, very useful explanation ✨

  • @cswalker21
    @cswalker21 2 роки тому

    Neat! Thanks.

  • @fabiyifabrice9773
    @fabiyifabrice9773 2 роки тому

    Thanks you

  • @phojie6868
    @phojie6868 Рік тому

    Why not use store instead, this practice makes the code not easy to read in the future

  • @matejstolfa4592
    @matejstolfa4592 2 роки тому

    Hi Hermiona

    • @MrCC-hx8xr
      @MrCC-hx8xr Рік тому

      Hermiona & Vue master = awesome combination ;-)

  • @matmister1769
    @matmister1769 2 роки тому +8

    emma watson?

  • @ackar82
    @ackar82 2 роки тому +1

    slowly vue just looks bloated and bad designed