← All questions
LWCMedium
Wired function invocation
When is the wired function in this component called?
import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class ContactViewer extends LightningElement {
@api recordId;
@wire(getRecord, { recordId: '$recordId', fields: ['Contact.Name'] })
wiredContact({ error, data }) {
if (data) { /* ... */ }
}
}