What Are Lightning Web Components?

Lightning Web Components

Lightning Web Components is a new programming model for building Lightning components. They will be GA with Spring 19 release going into 2019!

Why is there need for Lightning web components?

Until recently, web standards only offered a limited foundation for what developers need to build large scale web applications: a rendering engine, standard elements, events, and a core language (ECMAScript 5). In addition to being rudimentary, that foundation had other shortcomings traceable to its roots as a page rendering platform, not an application execution platform. For example:

  • Rendering wasn’t optimized for continuous UI transformation.
  • Standard UI elements were scarce and the standard didn’t support the creation of custom elements.
  • The core language lacked modern constructs to write large and modular enterprise-class apps at the client-side (modules, classes, promises, decorators, etc.).

What are challenges or gaps with current tech, like the Aura programming model?

In 2014, when Salesforce launched Lightning Component framework along with the Aura programming model, Salesforce was part of that effort to push the web forward and enable large scale client-side application development on the web. In the absence of standards, the Lightning Component framework came with its own component model and its own modular programming model.

Although community and software vendor efforts made it possible to develop large-scale client-side apps on the web, they also came with a number of challenges:

  • Frameworks became the language. React, Angular, and the Lightning Component Framework are all JavaScript, but they provide such a high level of abstraction that they feel like different languages.
  • As a result, skills were not transferable, and developers were hard to find and ramp up.
  • Apps and components written with different frameworks are not interoperable.

Why are Lightning web components superior to the old web stack?

The web stack looks very different today than it did five years ago, with its weight now heavily tilting towards standards. The core stack finally got the update it needed to become an application development platform in its own right. Many features that required frameworks now come standard; you no longer need a proprietary component model, proprietary language extensions, proprietary modules, etc.

The standardization of the core stack is incredibly exciting and opens the door to a new breed of frameworks, frameworks whose major task is no longer to fill in the gaps in the core stack, but to provide a thin layer of specialized services on top of a standard stack that is now suitable for large-scale app development.

The benefits are substantial:

  • Common component model
  • Common programming model
  • Transferable skills and easier to find/scale developers
  • Interoperable components
  • Better performance since core features are implemented natively in web engines instead of in JavaScript in framework abstractions

What does Lightning Web components have to offer?

Lightning Web Components is the Salesforce implementation of the new breed of lightweight frameworks built on web standards. It leverages custom elements, templates, shadow DOM, decorators, modules, and other new language constructs available in ECMAScript 7 and beyond.

Lightning Web Components provide a layer of specialized Salesforce services on top of the core stack, including:

  • The Base Lightning Components, a set of over 70 UI components all built as custom elements.
  • The Lightning Data Service, which provides declarative access to Salesforce data and metadata, data caching, and data synchronization.
  • The User Interface API, the underlying service that makes Base Lightning Components and the Lightning Data Service metadata aware, leading to substantial productivity gains.

Can Aura programming model co-exist with Lightning web components?

Aura components and Lightning web components can coexist and interoperate, and they share the same high level services:

  • They can coexist on the same page.
  • Aura components can include Lightning web components.
  • They share the same base Lightning components. Base Lightning components were already implemented as Lightning web components.
  • They share the same underlying services (Lightning Data Service, User Interface API, etc.).

What is your final take on Lightning web components?

If you are already developing Lightning components with the Aura programming model, you can continue to do so. Your Aura components will continue to work just as before. You can build new components with Aura or Lightning Web Components. Your Aura and Lightning Web Components can coexist and interoperate.

Over time, you can consider migrating your Aura Components to Lightning Web Components, starting with the components that would benefit the most from the performance benefits of Lightning Web Components.

What does the community think about Lightning web components?

Read Have Lightning Web Components retrocompatibility?

Do you want to know more about Lightning web components?

Have questions or something to say? Write to us at info@docmation.com

About the Author: Rajesh Varma Mudunuri is a Lightning Champ! He has been a leading contributor at the Salesforce Stack Exchange and has also addressed at Dreamforce. Find him here:
LinkedIn | Twitter