What are Lightning web components
Why so late ?
So why do salesforce introduced lightning web components so late. Why didn’t Salesforce introduced lightning web component instead of aura back then?
So let’s understand this first.
Let’s look at the 2014 web stack, you can see all the features and support which a framework require was not provided by the platform or we can say the browser. So all of these things like component, models, templates, rendering, optimizations, language extensions were taken care by the framework.
A lot of frameworks came into picture to fill this void created by the browser capabilities so similarly Aura was used as a framework.
But now over the years there are a lot of developments and enhancements into the web stack and see how web standard has been transformed.
Lightning web component web stack vs the aura web stack:
As a lot of functionalities that salesforce had built into the aura framework could now be taken out of their process and offloaded to the browser itself.
Now we can only see the security features like lightning locker service ,then lightning data service and the based lightning components which are present over here.
So rest of the things are handled by the browser itself.
As lot of companies or industries have switched from visualforce page to Aura components and suddenly lightning web component came so do we need to switch again everything to lightning web component?
What are the benefits of using lightning web components.
- First thing is lightning web component is compliant to the current web standard.
- Another thing is Lightning web component is a transferable skill so we can easily ramp up the developers using the lightening web components because it’s built on the current web standards so the other UI developers can acquire this skill very easily.
Coexistence of aura and lighting web component.
- Aura components and lightning web components can coexist inside the same page and also aura components can include the lightning web component however vice
versa is not possible so lightning component cannot include or aura component.
- Also lightning web components and aura components share same base lightning
components like we have lightning buttons LDS etc.
The way they are used a little bit different syntactically but the concept and the
base component itself are same.
- Also they use similar underlying services like they use lightning data service,
lightning Locker service etc.
- Lightning web components can easily interact with the aura component and they
can handle the events of one another. Events are created and handled differently in aura components and lightning web components but they can communicate with each other.
So whatever we have developed already in our components we can keep them as it is and we can keep using them and whatever new things come up we can develop that
using lightening web components and then we can communicate these two things using events.
Now when lightning the component came earlier there were lot of unsupported features, however most of them are being covered now by lightning web components.
so one of that was how can we use lightning web component inside of VF pages because most of the industries have developed VF pages earlier and
then they used to use sura component inside VF page using aura dependencies .
Earlier it was not possible to use lightning web components in a standalone applications or inside of VF pages but now we can do that also so.
We just have to create an aura application and then we have to use our lightning web component inside the application and then include that aura application
inside the VF page just like creating aura dependencies.b
Please find below the video if you want to watch demo for this: