If you are in the Salesforce ecosystem you would have probably heard about the new release of Lightning Web Components from Salesforce buzzing around the twitter and other channels of social media of Salesforce. So buckle up we're going to take an overview ride about this new programming framework and how it is going to be coupled with the existing lightning components.
Lightning Web Components is a new programming model for building Lightning components. It uses the core concepts of Web Standards to make itself interoperate with the existing Aura Components aka Lightning Components in Salesforce. So we have 2 programming languages to build amazing lightning components.
Challenges in Traditional Web Stack:
- Rending and UI transformation issues
- UI elements were not very customizable
- Language stack remained as a rendering platform than a client-side application development platform
- Frameworks become languages due to the lack of proper web standards
- Interoperability between different frameworks became a challenge in modern web development.
Web Standards established in recent few years:
- ECMAScript 6, 7, 8, 9
- Web Components
- Custom Elements
- Templates & Slots
- Shadow DOM
2019 Web Stack - Inspiration for Salesforce to come up with a new breed of programming language:
- More standards that give stability to be an application development platform
- The commonly used framework comes standard without proprietary component libraries/extensions
- Stable web stack now opens the door for vendors to concentrate on application development rather than filling the gaps
- Skillset becomes transferable and easy for the developers to cross skill and get up to speed.
- Better performance as it is natively supported in the web engine
- Interoperability across components
- Common Component Model and Common Programming Model.
The 3 specialized Salesforce services on top of the core Web Stack:
- Base Lightning Components - over 70 UI components
- Lightning Data Service - declarative access to Salesforce data and metadata, data caching, and data synchronization.
- API - the underlying service that makes Base Lightning Components and the Lightning Data Service.
So what it means to Developer Community:
- More Standards and Less Framework.
- No need to learn different frameworks to develop applications in Salesforce.
- Interoperability with Lightning components
- Better performance as it is based of the web engine rather than a JS framework
- Lightweight framework.
So when to start developing in Lightning Web Components?
- You can start anytime you like after the Spring'19 is GA.
- If you are already developing Lightning components with the Aura programming model, you can continue to do so. Your Aura components will continue to work as before. You can build new components with Aura or Lightning Web Components.
- Over time, you can consider migrating your Aura Components to Lightning Web Components, starting with the components that would benefit the most from the performance benefits of Lightning Web Components.
- If you are in a new project, I would recommend getting started with the Lightning Web Components.
Let's talk about its interoperability:
- Aura components and Lightning web components can coexist on the same page
- Aura components can include Lightning web components
- Aura components and Lightning web components share the same base Lightning components
- Aura components and Lightning web components share the same underlying services [Lightning Data Services and API]
- Well, everything in the world has its own limitations. It is there for a reason and so it does for LWC. Lightning web component can’t contain an Aura component. It must use Lightning web components all the way down its component subtree.
- But an Aura Component can contain an LWC that follows the above restriction.
And that's how the Lightning Web Components are born. As I said in the title this only a snapshot of what is being promoted as LWC and there are a lot of exciting features and convenience that comes along with it if you start to explore this new programming model. If you are part of any local Developer #TrailblazerCommunity start registering for the upcoming Developer Week 2019 events. There are lots of announcements and presentation talks, workshops coming your way to educate you more on the #LWC. Have a fun-filled learning!