Lightning Web Components

Introduction To Lightning Web Components

What are Lightning web components

Lightning web components are custom HTML elements built using HTML and modern JavaScript.Lightning web component uses core web standards and provides only what’s necessary to perform well in the browser supported by Salesforce.
Since it’s built on the code that runs natively on browser, lightning component is lightweight and exceptionally delivers the performance.Most of the code you write is in the standard HTML and JavaScript.

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.
Now all of these properiety things so these are handled by the web browser itself thus lot of decreased in the usage of frameworks and JavaScript. So Salesforce came up with the Lightning web components.

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.

  1. First thing is lightning web component is compliant to the current web standard.
  2. Lightning web component delivers exceptional performance because the core features are implemented natively in the web browser instead of in the JavaScript with framework abstractions ,so it no longer requires the user to download the JavaScript and then wait for engine to compile it before rendering the component
  3. 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.

  1. 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.
  2. 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.
  3. Also they use similar underlying services like they use lightning data service,
    lightning Locker service etc.
  4. 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:

Advertisements

2 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s