Saturday, September 23, 2023
HomeApexUnderstanding Lightning Web Component (LWC)

Understanding Lightning Web Component (LWC)

Today, Internet browser are taking care of a lot of the work.

Salesforce has launched Lightning Web Components.

It’s extra light-weight and highly effective.

It makes use of the native browser functionalities as much as possible.

We’ll cowl the native browser capabilities and also the brand new browser capabilities. Out of all of the options,an important function of recent browser is that they support web components.

Under are the Four building blocks of Lightning Web Component:
1) Templates
2) Custom Element
3) Shadow DOM
4) Imports

We’ll go through every of those constructing blocks one after the other.
1) Templates: It enable us to jot down markup inside <template> tag. This tag isn’t rendered on browser. That is very highly effective tag and it’s a part of HTML5 specification.This tag is used to outline how the content material can be proven and formatted.
Similar <template> tag could be reused all through the entire web page.

2) Custom Element: The Second constructing block of net element is Customized Component. We will create a customized HTML tag. Customized ingredient may also lengthen class HTMLElement. We additionally want to make use of window.customElements.outline technique to let browser know which one is customized ingredient. There are additionally life cycle strategies like connectedCallback and disconnectedCallback in customized ingredient if you wish to carry out some operations on these occasions.

3) Shadow DOM : One other vital a part of HTML Internet element is Shadow DOM. With the assistance of Shadow DOM, we are able to encapsulate construction and elegance from different parts. Shadow DOM can have numerous type with out effecting type of different parts. We don’t want to make use of completely different CSS lessons for similar ingredient if we need to encapsulate.

4) Import
Most elementary constructing block in net web page is using hacks or iframe. As a part of net parts, we now have the flexibility to import one other HTML web page utilizing the hyperlink tag.

 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments