What is a Lightning Web Component (LWC) and how does it differ from an Aura component?
Answer
LWC is Salesforce's component framework built on modern web standards (ES6+ JavaScript, Web Components, Shadow DOM, custom elements).
Key differences from Aura:
- Standards-based: LWC uses native browser features, Aura uses a proprietary framework, so LWC is faster and lighter.
- Files: LWC = HTML + JS + CSS + meta XML; Aura = .cmp, controller, helper, renderer, etc.
- Events: LWC uses standard DOM
CustomEvent; Aura has Component and Application events. - Performance: LWC renders faster because less framework code runs in the browser.
- Interoperability: LWC can be nested inside Aura, but Aura cannot be nested inside LWC.
Salesforce recommends LWC for all new development.
lwcbasics