Lightning Web Component @wire decorator
Sample
//js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import ACCOUNT_NAME_FIELD from '@salesforce/schema/Account.Name';
const FIELDS = [ACCOUNT_NAME_FIELD];
export default class LwcWire extends LightningElement {
@wire(getRecord, { recordId: '0016T00002zj9rlQAA', fields: FIELDS})
accountRecord;
get NameOfAccountRecord() {
if(this.accountRecord.data) {
return this.accountRecord.data.fields.Name.value;
}
return null;
}
}
//html
<template>
<lightning-card>
name : {NameOfAccountRecord}
</lightning-card>
</template>
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>58.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>
Result