Use Lightning Components in Lightning Experience

Learning Objectives

After completing this unit, you’ll be able to:
  • Describe the importance of Lightning components to Lightning Experience.
  • Name some of the key considerations for using Lightning components over Visualforce.
  • Identify three places where you can use Lightning components.

Lightning Components in Lightning Experience

By now you’ve read the word “Lightning” so many times it’s probably lost all meaning. Worse, we’ve been talking so much about both “Lightning Experience” and “Lightning components” that maybe the two terms are blurring together. Let’s clear up the relationship between the two.

Remember all that information about developing following either a page-centric or app-centric model? Salesforce Classic uses a page-centric model, but Lightning Experience uses an app-centric model. It’s made up of—you guessed it—components.

You can probably see where this is going. Lightning components were designed with Lightning Experience in mind. As the core Salesforce app shifts to the app-centric framework, we want you to shift along with us. We want you to think about developing on the platform in a whole new way.

You might have developed some Lightning components in Salesforce Classic. You can still use the old interface with Lightning components and all your existing component functionality transfers seamlessly into Lightning Experience.

If you haven’t worked with Lightning components yet, don’t worry. There’s a Trailhead module, a quickstart guide, and a full developer’s guide so that you can start developing in no time. Before you dive in to the technical details, let’s take a second to review some basic advantages of Lightning components: Out-of-the-Box Component Set Salesforce provides a number of components to bootstrap your app development. Performance The component framework leverages a stateful client (using JavaScript) and a stateless server (using Apex). This structure allows the client to call the server only when absolutely necessary. With fewer calls to the server, your apps are more responsive and efficient. Event-Driven Architecture Events are key to the Lightning component framework. Components listen to application and component events and respond accordingly. Rapid Development The simple markup and pre-made components mean that you can get applications out the door faster than ever. Particularly if you’re comfortable with Visualforce markup, learning component markup is a breeze. Device-Aware and Cross-Browser Compatibility A huge advantage of Lightning components is that you don’t have to worry about compatibility across devices and browsers. The component framework handles this work for you.

Considerations for Use

We’ve covered some of the considerations for using Lightning components. You probably don’t want to switch to Lightning components with in-progress Visualforce projects. You also want to stick with Visualforce if you need to do things like render PDFs from a page. Visualforce hasn’t gone away, and remains a foundational part of developing on the Salesforce platform.

The Lightning Component framework is, relatively speaking, the new kid on the block—but this new kid has skills. As of the Spring ’19 release (API version 45.0), you can build Lightning components using two programming models: the Lightning Web Components model and the original Aura Components model. Lightning web components are custom HTML elements built using HTML and modern JavaScript. Lightning web components and Aura components can coexist and interoperate on a page. While Lightning components have a few specific limitations, for the most part, they’re ready to go. There are many situations where you should consider making the switch to developing with Lightning components. Salesforce mobile development, for example, is a great place to use Lightning components. Also use Lightning components for new projects and any project involving highly interactive applications.

Let’s make a list! Where exactly can you use Lightning components? You have many options.
  • Lightning Experience We said it earlier, but don’t want you to get the wrong idea by leaving it off this list. Lightning Experience and Lightning components are two great tastes that taste great together.
  • Salesforce App We’re repeating this one often because it’s important: use Lightning components for your mobile development. When you’re using a mobile device, you don’t want to make a call to the server every time a user presses a button. Using Lightning components vastly improves mobile app performance.
  • Standalone Apps If you used Lightning components in Salesforce Classic, you probably made at least one standalone Lightning app. Lightning App Builder lets you declaratively create apps with standard components ranging from buttons to Canvas apps. Alternatively, use the Developer Console to create apps made up of both standard and custom Aura components. See the Lightning Aura Components Developer Guide for more information.
  • Visualforce Pages This capability is perfect for Salesforce developers who are Visualforce veterans. If you’re not quite ready to commit to a full Lightning app, smooth the transition by integrating Aura components into Visualforce pages. This task only requires a few lines of markup and gives you a huge amount of flexibility. See the Lightning Aura Components Developer Guide for more information about Aura components for Visualforce.
  • Anywhere! Lightning Out, currently available in beta, lets you run your Aura components and apps, well, pretty much anywhere you can serve a web page. Whether it’s a Node.js app running on Heroku, a department server inside the firewall, or even SharePoint (yes, SharePoint), build your custom app with Lightning components and run it wherever your users are.
  • Screen Flows If you haven't taken advantage of screen flows yet, you're missing out on a powerful way to guide your users through a business process. Customize the look-and-feel and functionality of your flow’s screens by adding Aura components to them.

As much engineering effort as we’ve put into making Lightning components a framework you can use to create applications for the next decade, we’re not done. There’s still a few places where you can use Visualforce to customize Salesforce but you can’t yet use Lightning components. Stay tuned to this channel.

Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities