ApexSensei

Why LWC

Choose LWC for new interface work. It is standard HTML and JavaScript, and it can share a page with Aura.

The browser already knows this code

LWC is built on the web component standards. A class extends LightningElement, a template is HTML, and the browser renders the element.

Salesforce follows those standards on purpose. The framework adds what a Lightning page needs, such as data and security, and leaves the rest as ordinary JavaScript.

Aura can stay on the page

Aura components still run. An LWC and an Aura component can sit on the same Lightning page, and an admin sees both as Lightning components.

When you are choosing a model for new work, choose LWC. Use Aura when you are maintaining an Aura component that is already in production.

Where a component runs

Lightning web components are available in Lightning Experience, in Enterprise, Performance, Unlimited, and Developer Edition.

Base components in the lightning namespace, such as lightning-button and lightning-input, are the building blocks Salesforce already styles. Start with those before you draw a control yourself.

Example

html

<template>
  <lightning-button label="Save" onclick={save}></lightning-button>
</template>