Understanding Asynchronous JavaScript

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

КОМЕНТАРІ • 14

  • @israel8627
    @israel8627 Рік тому +1

    The greates class regarding async js patterns. Thanks a lot!

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

    This is one of the best videos I have seen on the subject. Thank you!

  • @ajeetsingh4974
    @ajeetsingh4974 3 роки тому +1

    Nicely explained, I liked the way this complex topic is covered

  • @soulxs8123
    @soulxs8123 3 роки тому

    My colleague uses a lot of complex approaches developing his lwc components, so when I want to learn something new, I just look at his code ) But always good to have a good explanation, thanks!

  • @DevsLikeUs
    @DevsLikeUs 3 роки тому +1

    Great explanation.

  • @darrellgallegos6997
    @darrellgallegos6997 Рік тому +1

    Great video and explanation. I am working through a scenario which I have a parent Aura component and child LWC. I need response data from a callout to use with the child LWC. I am trying to determine if it is best to make the callout in the parent AURA and rely on the response data to be captured in a variable and passed to the child LWC. This I believe would require initializing the child LWC after response is return from callout OR execute the callout from the child as an await function in the async connectedCallback. Thoughts?

    • @pozil
      @pozil Рік тому +2

      Thanks for the feedback. Without seeing the source code, I will make some assumptions here but perhaps you could do the callout in the parent and pass the data down to the child. This provides better decoupling (the LWC only focuses on rendering) and this eases testing.
      You would have to ensure that your LWC doesn't crash when passed the initially "empty" data while waiting for the callout. I generally have a "loading" state that displays a spinner while waiting for async data. You can do this in the parent or the child.

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

      @@pozil Thanks for following up. That is interesting you mention the Parent cmp. That was my initial thought; however, my concern was this "loading" state EXACTLY. Do you have a resource or code snippet I could reference that shows this loading state gating? That would be awesome.

    • @pozil
      @pozil Рік тому +1

      @@darrellgallegos6997 I couldn't find one quickly so here's a PR on LWC Recipes with an example: github.com/trailheadapps/lwc-recipes/pull/742/files

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

      @@pozil Thank you I'll check it out.

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

      @@pozil So I took a look at this. I see the spinner for sure. Would the 'inLoading' variable be used in a template directive around the child component to only load the child component when ? This is the way I am understanding concept.