Skip to content
Everything you need to know about Lightning web components and migration

Everything you need to know about Lightning web components and migration

Rahul Kobare, Saurabh dubey

Better performance, better user experience, and better security – these are the key parameters driving developments and innovation in the realm of technology. One of the most exciting developments in the past year has been the release of Lightning Web Components by Salesforce, which delivers on each of these parameters. This new programming model leverages custom templates, elements, modules, shadow DOM and decorators. It offers a set of specialized services that are an extension of the existing cutting-edge web technologies and core stack, including Lightning Data Service, User Interface API, and base lightning components.

In the past year, it has shown immense potential in bringing benefits to developers. Let’s look at Lightning Web Components closely to understand what they are, how and why you should migrate to them.

What are Lightning Web Components?

To understand Lightning Web Components, we need to understand the tech it is built on. The ‘components’ concept has existed in the webspace for quite some time and the basic idea is to split the User Interface (UI) components into smaller chunks, which are reusable and self-contained.

Even though this approach became more and more commonplace, there remained limitations in terms of their implementation across a spectrum of frameworks. In that sense, these components are fragmented and isolated entities. For instance, a React component cannot be dropped as it is into the Angular or Vue framework and vice-versa.

Which brings us to our next question – what is a web component? These are primarily a set of standards of different specifications.

  • HTML templates: User-defined HTML templates that are rendered only when called upon. This template is best embodied in the HTML Living Standard specification.
  • Custom Elements: These HTML elements have customised templates, behaviors and tag names made using a specific set of JavaScript APIs.
  • Shadow DOM: These are used for isolating JavaScript and CSS. A shadow Document Object Model or DOM is a method of creating components within the DOM.
  • ES Modules: This specification refers to the reuse and inclusion of JS documents in a modular, standard-based, and performant way.

Lightning Web Components are essentially built on top of these elements by using standardization as a tool to create and implement a new variety of lightweight web frameworks. These new frameworks are designed to bring specialized functionality to the platform instead of just plugging gaps within. Lightning Web Components by Salesforce are built on top of the above-mentioned web components by leveraging the latest JavaScript standards and infusing it with functionalities tailored to Salesforce.

Benefits of Lightning Web Components

The new lightweight framework comes with a whole host of advantages over the existing Aura web components. The following benefits are the reason why most businesses are (and should) considering migrating to Lightning Web Components:

  • Ease of Use: This new framework is developed through the native web standards present in the browser and there is no additional abstraction layer like the ones found in frameworks such as Aura.
  • Improved Performance: The absence of an abstraction layer makes it faster to render than components of Aura. Hence, improving performance through deliverability.
  • Faster Loading: As the use of the word ‘lightning’ in its name suggests, this framework loads the developed components a lot faster than its predecessors.
  • Out-of-the-Box Usage: The built-in browser security features in this framework reduce the need for customization, facilitating a more out-of-the-box usage.
  • Reusable Components: You can write components that can be seamlessly reused in other components since there are no UI limitations here. 
  • Easy to Learn: Developers working with Lightning Web Components do not need to learn any additional framework, making the transition smooth.
  • Better Results: Lightning Web Components can deliver on parameters of better testing, browser compatibility, and security, owing to the way it used Script, CSS, and DOM Isolation.

Migrating to Lightning Web Components

There is no disputing the fact that more and more businesses are recognizing multiple benefits that come from embracing Lightning Web Components.

That said, there are a few challenges that one has to brace for when making that shift:

  • User Adoption: The time that needs to be invested in training the workforce to use this new UI and understand its workings.
  • Record Sharing: Lightning Web Components have limitations when it comes to record sharing options. 
  • Slow: A load of functionalities and data can lead to a slower speed of operations.
  • JavaScript Buttons: It does not support custom JavaScript buttons, which needs to be addressed through building quick action, workflow rules or triggers.
  • On-page Search: The option of an on-page search is unavailable on Lightning Web Components.
  • Redesigning: It requires redesigning of all Visualforce pages prior to migration.
  • Event Attendees: A feature missing from Lightning Web Components.
  • URLs: It does not support the common URL hack to auto-populate.
  • Task Status: Manual processing required for transferring completed tasks with all the changes intact.

The Correct Approach to Migration

To ensure that these limitations do not come in the way users extracting optimal benefits from Lightning Web Components, it is imperative to migrate using the right approach. The solution must be designed on the principles of configuration. Additionally, using out-of-the-box functionalities helps in ensuring scalability and the readiness to embrace new features. Deprecation of components with every subsequent release is a possibility, but it can be managed through configurations at the platform level to accommodate changes in the business process due to expansion, strategy modifications, the addition of new users, or new acquisitions.

Application Services

Also read: