You need to sign in to do that
Don't have an account?
Wade Lovell 84
Use Apex to Work with Data - The '=' sign in 'columns = COLUMNS' is the source of the error, "Class properties must be methods."
Javascript / Trailhead Challenge issue.
import { LightningElement, wire } from 'lwc';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';
const COLUMNS = [
{ label: 'Contact First Name', fieldName: FIRSTNAME_FIELD.fieldApiName, type: 'text' },
{ label: 'Contact Last Name', fieldName: LASTNAME_FIELD.fieldApiName, type: 'text' },
{ label: 'Email Address', fieldName: EMAIL_FIELD.fieldApiName, type: 'text' }
];
export default class ContactList extends LightningElement {
columns = COLUMNS;
@wire(getContacts)
contacts;
}
Throws this error, "Class properties must be methods. Expected '(' but instead saw '='. (E054)' Seems this may be a the premature use of a feature at Stage 2 but not generally available (except in packages like Babel, perhaps?).
Would like to complete the challenge.
Thanks in advance,
Wade
import { LightningElement, wire } from 'lwc';
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';
const COLUMNS = [
{ label: 'Contact First Name', fieldName: FIRSTNAME_FIELD.fieldApiName, type: 'text' },
{ label: 'Contact Last Name', fieldName: LASTNAME_FIELD.fieldApiName, type: 'text' },
{ label: 'Email Address', fieldName: EMAIL_FIELD.fieldApiName, type: 'text' }
];
export default class ContactList extends LightningElement {
columns = COLUMNS;
@wire(getContacts)
contacts;
}
Throws this error, "Class properties must be methods. Expected '(' but instead saw '='. (E054)' Seems this may be a the premature use of a feature at Stage 2 but not generally available (except in packages like Babel, perhaps?).
Would like to complete the challenge.
Thanks in advance,
Wade
Anudeep (Salesforce Developers)
Try reaching out to Trailhead Support for assistance
Wade Lovell 84
Thank you Anudeep for the suggestion. I happen to know Trailhead Support is overwhelmed with over a three business day backlog because I actually needed something Sunday night ONLY they could do.
Definitely wanted to reach out to the Community first for this one.
Make it a great one,
Wade