Activity › Forums › Salesforce® Discussions › What is the use of @track in lightning web component?

  • What is the use of @track in lightning web component?

    Posted by Deepak on September 27, 2019 at 8:26 AM

    What is the use of @track in lightning web component?

    Saddam replied 7 years ago 3 Members · 2 Replies
  • 2 Replies
  • Prachi

    Member
    September 27, 2019 at 10:47 AM

    Hi,

    To track a private property’s value and rerender a component when it changes, decorate the property with @track. Tracked properties are also called private reactive properties.

    You can use a tracked property directly in a template. You can also use a tracked property indirectly in a getter of a property that’s used in a template.

    You can use @track to decorate a property only; you can’t use it to decorate an object. You can decorate multiple properties with @track, but each property can have only one decorator.

    Thanks.

  • [adinserter block='9']
  • Saddam

    Member
    September 30, 2019 at 5:59 AM

    Hi,

    To track a private property’s value and rerender a component when it changes, decorate the property with @track. Tracked properties are also called private reactive properties.

    You can use a tracked property directly in a template. You can also use a tracked property indirectly in a getter of a property that’s used in a template.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos