Lightning web components, a new way to develop Lightning Components has gone live in Spring19 (Feb -2019) release of Salesforce. What was the need for it? When we just got comfortable with Lightning/Aura framework development, do we really need LWC? Let’s find out.
Chapter 1 - Why Lightning Web Components?
The simple answer is, Yes, we need LWC and the reason is to leverage more web standards rather than framework layers to build these components, which results in faster components.
When Lightning Components (from now on Aura Components) and framework were introduced back in 2014, the web standards were not evolved much, making it almost impossible to create reusable components. Let’s have a look at the web standards back in 2014:
Custom framework came in the picture to fill this gap. Component-based frameworks allowed us to develop reusable components which can be used at multiple places.
Each framework came with its own way of writing these components with different syntax and methodologies. Aura framework was part of this league and allowed Salesforce developers to create these awesome reusable components.
This had been tough on developers for sure since to create these components, they had to learn the complete framework first, they had to learn the syntax, methodologies and best practices.
Only if there was a standard way of writing these components, phew!!
Well, now this is possible. Web technology has evolved, new EcmaScript modules being released, and with all these, new web standards being introduced. Let’s have a look at present web standards:
If you have a look, everything you need to develop these components is now part of standard web-stack., which means, we do not need frameworks to build reusable components anymore. It comes with many advantages:
– Learning LWC would be easier as it based on web standards.
– LWC works pretty well with existing Aura Components, which means LWC components can interact with Aura Components. You can place LWC and Aura Components on the same page.
In the next chapter of this code by code guide, we will learn more about LWC and will start developing our first LWC component.