Wednesday, 22 July 2020

Why LWC?

Why Lightning Web Components?

Modern browsers are based on web standards, and evolving standards are constantly improving what browsers can present to a user. We want you to be able to take advantage of these innovations.

Lightning Web Components uses core Web Components standards and provides only what’s necessary to perform well in browsers supported by Salesforce. Because it’s built on code that runs natively in browsers, Lightning Web Components is lightweight and delivers exceptional performance. Most of the code you write is standard JavaScript and HTML.

You’ll find it easier to:

  1. Find solutions in common places on the web.
  2. Find developers with necessary skills and experience.
  3. Use other developers’ experiences (even on other platforms).
  4. Develop faster.
  5. Utilize full encapsulation so components are more versatile.
Basic Example to create the LWC Component

HTML

<template>
    <input value={message}></input></template>

    <template> is Fundamental building block, It stores pieces of HTML


JAVASCRIPT


export default class App extends LightningElement {
  message = 'Hello SFDCBlogger';
}
import { LightningElement } from 'lwc';


CSS

input {
   color: green;}


The LWC bundle comes with same name in same folder!!.

Salesforce compiles your files and takes care of the boilerplate component construction for you automatically.



LWC Aura can work Together?

    -Yes

Aura components can contain Lightning web components (though not vice-versa). But a pure Lightning web components implementation provides full encapsulation and evolving adherence to common standards.

To develop Lightning web components efficiently
  • Dev Hub and Scratch Orgs
  • Salesforce Command Line Interface (CLI)
  • Lightning Component Library

Scratch Org >> Disposable >> Support for Development and Testing

Dev Hub >> Manages the scratch Orgs

Salesforce CLI Prvides run opertions for creating & configuring the scratch orgs and deploying components

CLI (Command Line Interface), Scratch Org & Dev Hub are part of Salesforce DX tools





No comments:

Post a Comment