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

  • 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.

  • 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