In Lightning Web Components (LWC), decorators are special expressions in JavaScript that are used to configure and define metadata for the class fields or methods.
Decorators in LWC are used to add functionality or metadata to a component's properties, methods, or other class members.

There are several decorators available in LWC, and some of the commonly used ones include:

@api: This decorator is used to expose a public property or method that can be used by the parent components.


@track: This decorator is used to track changes in a property and re-render the component when the property changes.


@wire: This decorator is used to connect a component to the Lightning Data Service (LDS) to retrieve and update data.

Code:

import { LightningElement, wire } from 'lwc'; import getAccountList from '@salesforce/apex/MyController.getAccountList'; export default class MyComponent extends LightningElement { @wire(getAccountList) accounts; }