Salesforce Lightning Web Components – What are they? What are the Benefits? 

Salesforce, a popular CRM solution for a large variety of verticals is one of the most configurable systems in the CRM market. 

In December 2018 Salesforce introduced a new platform called Lightning Web Components (LWC). It allows the user to easily customise Salesforce products. Since LWC has come into existence we now have the ability to create Lightning components in the following ways:

    • Aura components – also known as lightning components.
    • Lightning Web Components – the newest way to create lightning components.

Some of the reasons why Salesforce created LWC include: 

  • Modern JavaScript – 
    • The JavaScript language with ES6+ and web standards, such as HTML templates, custom elements, and web components have evolved significantly in the last few years. 

 

  • Developer productivity and satisfaction – 
    • Learn to build Lightning web components swiftly because you’re using standard JavaScript, HTML, and CSS. 

 

  • Ability to write less code with Lightning web components that is easier to read, maintain and unit test.
    • Using web standards boosts performance because more features are executed natively by the browser instead of by a JavaScript framework. 

 

  • Migration strategy – 
    • Migrating code is rarely a straight path. The programming model for Lightning Web Components is fundamentally different than the model for Aura Components. 
    • The easiest components to migrate are simple components that only render UI. An Aura component whose performance is critical is a good candidate to migrate to a Lightning web component.

 

    • Web Components consist of four separate technologies that are used together:
      • Custom Elements: The HTML elements with custom templates, tag names like and behaviours are made with a set of JavaScript APIs. HTML Living Standard specification has definitions of these Custom Elements.
      • Shadow DOM: We use this for isolating CSS and JavaScript which could be like. Living Standard DOM specification has the definitions of this.
      • HTML templates: User-defined templates in HTML are rendered only when called upon. HTML Living Standard specification has the definition of the tag.
      • ES Modules: The ES Modules specification defines the inclusion and reuse of JS documents in a standard-based, modular, performant way.

 

  • ECMAScript

 

      • ES6 (ECMAScript 2015)
      • ES7 (ECMAScript 2016)
      • ES8 (ECMAScript 2017)—excluding Shared Memory and Atomics
      • ES9 (ECMAScript 2018)—including only Object Spread Properties (not Object Rest Properties)

 

Why would you turn to LWC instead of existing Aura Components?

 

    • Easy to learn: LWC takes form through native web standards within the browser. 
    • Better performance: Because of the no added abstraction layer, LWC is likely to render faster than aura components since performance is important to deliverability.
    • Faster loading sites: Like lightning, LWC is faster in loading the developed components than Aura Components and is a lightweight framework which is built on web standards.
    • More standards, less proprietary: LWC has built-in browser security features from Web Components Standards, so the usage of out-of-the-box is more and less of customization. 
    • Common components/Service components: We can now write components that have no User Interface in LWC, and those components can be reused in other components which are more efficient than static resources.
    • Easier to ramp for developers: No additional framework is needed to learn in order to develop LWC and hence transition for the developers is a lot easier.
    • Better security, better testing and better browser compatibility: With LWC, CSS, Script and DOM Isolation are better and has more limited event scope. With each of these, we have more consistency in designing components. 
    • LWC also supports two-way data binding with which we can coordinate how data moves between components.

 

Overall Salesforce’s Lightning Web Components have greatly increased the ease at which developers can customise Salesforce products to their need and marks a key point in ensuring that the needs of modern businesses can be met. 

Share This