User Interface25% of the exam
Lightning Web Components: decorators, lifecycle, events and data
How a Lightning web component is built and wired: the @api, @track and @wire decorators, the lifecycle hooks, custom events and their propagation, Lightning Message Service, Lightning Data Service forms and adapters, styling and Aura interoperability.
Describe the use cases and best practices for Lightning Web Components, including the framework, benefits, and events.
~7 min read · 21 practice questions ·
What the exam expects
- Explain the framework's benefits and how LWC and Aura coexist and nest.
- Pick
@api,@trackor@wire, and fix a component that doesn't rerender. - Place work in the right lifecycle hook.
- Choose the communication pattern from where components sit, and name, configure and dispatch custom events by the documented best practices.
- Use Lightning Data Service before custom code, and load styling and third-party libraries correctly.
Key terms: custom event (a CustomEvent dispatched to ancestors), shadow boundary (the line encapsulating a component's DOM and CSS), wire adapter (a data source @wire subscribes to), Lightning Data Service (the shared client record cache), message channel (the topic Lightning Message Service publishes to).
Key facts
Nesting direction
- Detail
- Aura can contain LWC; LWC can't contain Aura
Field reactivity
- Detail
- All fields reactive since Spring '20;
@trackonly for object properties or array elements
Constructor
- Detail
- No public property values or child elements yet
renderedCallback()- Detail
- After every render, child to parent
Event defaults
- Detail
bubbles: false,composed: false; bubbling phase only
Event names
- Detail
- No uppercase, no spaces, underscores between words, no
onprefix
Across regions
- Detail
- Lightning Message Service, also reaching Aura and Visualforce on the page
LDS cost
- Detail
- No API usage calls; respects CRUD, FLS and sharing
Third-party JavaScript
- Detail
- Static resource plus
loadScript
Sources for this section (9)
- Aura Coexistencedeveloper.salesforce.com (opens in a new tab)
- Decoratorsdeveloper.salesforce.com (opens in a new tab)
- Component Is Createddeveloper.salesforce.com (opens in a new tab)
- Component Rendersdeveloper.salesforce.com (opens in a new tab)
- Event Propagationdeveloper.salesforce.com (opens in a new tab)
- Create Eventsdeveloper.salesforce.com (opens in a new tab)
- Message Servicedeveloper.salesforce.com (opens in a new tab)
- Lightning Data Servicedeveloper.salesforce.com (opens in a new tab)
- Third-Party Librariesdeveloper.salesforce.com (opens in a new tab)
- Why does a component fail to rerender after `this.order.status = 'Closed'`?
- When should a component use Lightning Message Service instead of a custom event?
- Why send primitives, or a copy, in an event's `detail`?
- Which base component builds a layout-driven create and edit form without Apex?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Platform Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 21 lessons of the Platform Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (21 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams