Activity Forums Salesforce® Discussions What is property in LWC in Salesforce?

  • Deepak

    Member
    September 27, 2019 at 12:52 pm

    If the value of a reactive property changes, the component rerenders. A reactive property can be public or private. When a component rerenders, all the expressions used in the template are reevaluated.

    Public Properties
    To expose a public property, decorate it with @api. Public properties define the API for a component. An owner component that uses the component in its markup can access the component’s public properties. Public properties are reactive. If the value of a reactive property changes, the component rerenders. When a component rerenders, all the expressions used in the template are reevaluated.
    Tracked Properties
    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.
    Reactive Property Data Types
    There are some limitations on the depth of changes tracked for rerendering in reactive properties. The tracking depth depends on the type of the reactive property.
    Boolean Properties
    Boolean attributes on standard HTML Elements are set to true by adding the attribute to the element. The absence of the attribute defaults the attribute to false. Therefore, the default value of an attribute is always false. Lightning web components use the same principle for boolean properties.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos