3

I started working with Lightning Web Components and was doing the Quick Start: Lightning Web Components project, on deploying source to org, I am getting the following error in VS Code output Panel

SyntaxError: /home/sfdc/tools/lwc/0.34.7/helloWorld.js: LWC1100: Invalid decorator usage. Supported decorators (api, wire, track) should be imported from "lwc"

Below is code in helloWorld.js as mentioned in trailhead

import { LightningElement } from 'lwc';
export default class HelloWorld extends LightningElement {
    @track greeting = 'World';
    changeHandler(event) {
        this.greeting = event.target.value;
    }
}

How do I import these decorators from 'lwc'?

1 Answer 1

9

You must add them to your import statement. You’re using @track, so you should have the following:

import { LightningElement, track } from 'lwc';

You can read more about reactive properties, how to import them and use them here.

You should have a look to the whole Dev Guide to learn more about LWC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .