Fields, Properties, and Attributes
Declare fields in your component’s JavaScript class. Reference them in your component’s template to dynamically update content.
Field and property are almost interchangeable terms. A component author declares fields in a class. An instance of the class has properties. To component consumers, fields are properties. In a Lightning web component, only fields that a component author decorates with @api
are publicly available to consumers as object properties. LWC observes changes to the values of fields and properties. See Reactivity.
Property and attribute are almost interchangeable terms and can be confusing. Generally speaking, in HTML we talk about attributes, and in JavaScript we talk about properties.
Lightning web components reflect the properties of many Web APIs. For accessibility, you can also control whether public JavaScript properties appear as attributes in the rendered HTML of a Lightning web component. See Reflect JavaScript Properties to HTML Attributes.
If you’ve developed an Aura component, you’re familiar with the term attribute. In a Lightning web component, the closest thing to an Aura attribute is a JavaScript property.
Additionally, you can learn how to work with: