I have the following js code : -
export default class MapContact extends LightningElement {
@wire(getRecord, { recordId: '0035g000007MUTlAAO', fields: [NAME_FIELD, ADD_FIELD] })
contact
getData() {
console.log(this.contact);
console.log(1221);
}
}
and this is the html : -
<template>
<button onclick={getData}>A button</button>
</template>
this.contact gives undefined. Is there anything wrong with this code ?