- What’s a web component?
- What is LWC and how is it different then “Aura Components” what was previously known as “Lightning Components”
- Benefits of using LWC
- Where are Lightning Web Components supported?
- Where to start learning LWC
What is Web Components
A web component is a DOM element created through reusable code. Each component is meant to save developers time when building websites that use similar elements on many pages.
Web components are based on four main specifications:
- Custom Elements – The Custom Elements specification lays the foundation for designing and using new types of DOM elements.
- Shadow DOM – The shadow DOM specification defines how to use encapsulated style and markup in web components.
- ES Modules – The ES Modules specification defines the inclusion and reuse of JS documents in a standards based, modular, performant way.
- HTML Template – The HTML template element specification defines how to declare fragments of markup that go unused at page load, but can be instantiated later on at runtime.
LWC is a New Programming Model
Lightning Web Component is a brand new lightweight framework built on web standards. You must be wondering about web standards team and why is it being so important for Lightning Web Components then I must tell you that “Web standards are rules and guidelines established by the World Wide Web Consortium (W3C) developed to promote consistency in the design code which makes up a web page. Without getting technical, simply it’s the guideline for the mark-up language which determines how a web page. displays in a visitor’s browser window.” Since, Salesforce is committed to developing open web standards and is a member of the World Wide Web Consortium (W3C), it has become important encouraging development around web standards on Lightning Platform.
Why should I switch to LWC programming model
This is a question which I would love to answer. This question has become relevant to every developer / Salesforce partner after release of this one more new programming model for Salesforce development. Salesforce customers who were planning to roll-out Lightning Experience in their Salesforce org had plans to convert Visualforce pages and components into Aura Components but now they are wondering why is this new LWC launched when they already had Aura Frameworks. Do they need to revisit their plans to switch to Lightning Web Components? Here is the answer of your question –
- If you have already converted VF pages and components into Aura Framework then stick with it for now and Use Lightning web components for new components only.
- If you have a long way to go and just started on this path then switching to web components would be a wise decision
- If you’r seeing any performance issues with existing work mainly in rendering delays then, LWC could be a good bet.
Benefits of using LWC
- Lightning Web Components (LWC) used HTML5, ES6, CSS3 which utilise browser APIs for rendering the UI and it give users a seamless experience.
- Web components use browser’s native API support to render UI which reduces the overheads of using other JS libraries and CSS.
- You can compose Aura components from Lightning web components, but not the other way around.
Lightning Web Component is a new programming model and it’s still need more time to be available in a full-fledged manner. Currently, LWC can be used in limited areas which are following.
- Lightning Experience
- Salesforce App
- Lightning Communities
- Lightning App Builder
- Community Builder
- First-Generation Managed Packages
- Second-Generation Managed Packages
- Unlocked Packages
- Unmanaged Packages
- Change Sets
- Metadata API—LightningComponentBundle
- Tooling API—LightningComponentBundle, LightningComponentResource
Areas where we have to wait to use “lwc”
- Lightning Out
- Lightning Components for Visualforce
- Standalone Apps
- Salesforce Console (Navigation Item API, Workspace API, UtilityBar API)
- URL Addressable Tabs
- Snap-ins Chat
- Lightning for Gmail, Outlook Integration
- Apex Continuations
- EMP API, Conversation Toolkit API, Omni Toolkit API, Quick Action API
- Standard Action Overrides, Custom Actions, Global Actions, List View Actions, Related List View Actions
- Chatter Extensions
Where to start learning LWC
You can learn it through the following resources –
- Getting started with lightning web components on Trailhead.
- Lightning Web Components episodes from Salesforce Developers.
- Lightning Web Components official documentation – Introducing Lightning Web Components.
I am certified Salesforce Developer with Sales and Service cloud certifications. I am a true believer in #GivingBack principle and a Salesforce enthusiast. I am working as a member of our #SalesforceOhana to learn and help other fellow Trailblazers of the community to grow and learn.
“I’m a true believer in karma. You get what you give, whether it’s bad or good.”