Yashotantra Academy logo

2 · Salesforce Developer

6. Lightning Web Components

Build modern UI with standard JavaScript components.

12 min read · 3 MCQs

LWC basics

An LWC is an HTML template, a JavaScript class and a metadata file. Use @api for public properties and @wire to read data reactively.

import { LightningElement, api, wire } from 'lwc';
import getCourses from '@salesforce/apex/CourseController.getCourses';

export default class CourseList extends LightningElement {
  @api recordId;
  @wire(getCourses, { accountId: '$recordId' }) courses;
}

Chapter quiz

3 questions · pass mark 75%
  1. 1. Which decorator exposes a public property?

  2. 2. What does the $ prefix in '$recordId' mean in @wire?

  3. 3. Apex methods called from LWC must be annotated with…