LWC Getters and Setters | Use Getters and Setters in Lightning Web Components | Basic to Advanced

Поділитися
Вставка
  • Опубліковано 6 лис 2020
  • Hello Trailblazers, In this video we're going to learn about getters and setters in LWC. We're going to see how we can use the getters and setters in LWC to modify data and add validations.
    Pre Requisites:- Setup a local development server in LWC - • Getting Started with L...
    Code:- github.com/rahulmalhotra/sale...
    Subscribe to SFDC Stop:- ua-cam.com/users/sfdcstop?su...
    LWC Todo App Project Tutorial Series - • Simplifying the Callou...
    Interested in learning about Scratch Orgs and SFDX ? Have a look at the playlist:- • Getting started with S...
    Interested in learning about Integration ? Have a look at this playlist:- • Salesforce Integration...

КОМЕНТАРІ • 23

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

    Again a great tutorial .. 👍 Really helpful.

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

    nice n simple way to explain things

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

    Well explained keep posting new vedios.

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

    all your sessions are really useful whether it is Lightening, Integration, LWC.

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

      Glad you liked them Ramya, Keep Learning!!

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

    Nice tutorial.

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

    Great example -> thank you

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

    Great explanation. Your teaching is amazing. Can you please upload more videos on LWC. You have not uploaded videos recently. Looking forward to seeing more videos

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

      Hi Chithra, Glad you liked the tutorials. I will make a new announcement soon, more videos are on the way!! Stay tuned :)

  • @Om108-21
    @Om108-21 3 роки тому +2

    sir when we can do CRUD operation on button click event or onload event or onchange event then why we need getter and setter?
    we can also implement validations in same oncliick function

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

      Good question Ronak. The answer is simple:- Reusability. Sometimes it happens that you're using the same object at multiple places/forms and it can be updated from anywhere. So, getters and setters are the best way to ensure that the validations will be applied no matter where the object is being used.

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

    Hi,
    why are you using lightning card inside div tag... both are used to group related information right. Then what is the need of using two tags.

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

      Hi, that's only added to provide a specific defined width to my card which is mentioned in the div.

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

    How can we pass value from parent Aura component to child (get set) variable

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

      Hi srinivas, you can simply create an @api annotated variable in lwc and pass it's value from parent aura component.

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

    If we want to display a property like {Person.FirstName} using getter, what would be the name of the get mehod ?

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

      get firstName()

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

      You can also use get personFirstName() if there are more firstName fields

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

      @@sfdcstop doesn't seem to be working with either :(

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

      name of getter won't return you any data, you need to return the data yourself depending upon what record you're having

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

      @@sfdcstop Specific getter will be called depending on the value attribute yeah? But variable like Person.FirstName can have dot notation, method names can't. So seems getter can't be used without changing variable name.