A quick crash course in LWC decorators:
@api - To expose a public property, decorate a field with @api. Public properties define the API for a component.
To expose a public method, decorate it with @api. Public methods are part of a component’s API. To communicate down the containment hierarchy, owner and parent components can call JavaScript methods on child components.
@track - Fields are reactive. If a field’s value changes, and the field is used in a template or in a getter of a property that’s used in a template, the component rerenders and displays the new value.
There is one use case for @track. When a field contains an object or an array, there’s a limit to the depth of changes that are tracked. To tell the framework to observe changes to the properties of an object or to the elements of an array, decorate the field with @track.
@wire - To read Salesforce data, Lightning web components use a reactive wire service. When the wire service provisions data, the component rerenders. Components use @wire in their JavaScript class to specify a wire adapter or an Apex method.
ref: https://developer.salesforce.com/docs...
In questa pagina del sito puoi guardare il video online Decorators - Lightning Web Components della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Jonathan Fox 07 dicembre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 412 volte e gli è piaciuto 14 spettatori. Buona visione!