CRT-450 practice question 14 of 30
Which three code lines are required to create a Lightning component on a Visualforce page? Choose 2 answers
Full set: 201 questionsTo host a Lightning component on a Visualforce page, a three-step process known as Lightning Out is required. First, the tag is added to the Visualforce page, which includes the necessary lightning.out.js library. Second, the $Lightning.use() JavaScript function references a Lightning dependency app, which makes the required components available. Finally, inside the callback function of $Lightning.use(), the $Lightning.createComponent() function is called to dynamically create an instance of the component and inject it into the page's DOM. All three are essential and work in sequence.
D. : This tag includes the Salesforce Lightning Design System (SLDS) for styling. While recommended for a consistent look and feel, it is not required to functionally create the component.
E. #Lightning.useComponent: This is not a valid or recognized function or syntax for using Lightning components in Visualforce. It appears to be a fabricated distractor.
1. Salesforce Developers
Lightning Aura Components Developer Guide: The section "Use Lightning Components in Visualforce Pages" explicitly details the required steps. It states
"Add the Lightning Components for Visualforce JavaScript library to your Visualforce page using the component." It then provides a complete example showing the use of $Lightning.use("c:myLightningApp"
function() { ... }); and $Lightning.createComponent("c:myComponent"
...); within the script block.
2. Salesforce Developers
Visualforce Developer Guide: The entry for the tag states its purpose is to "Add the Lightning Components for Visualforce JavaScript library to a Visualforce page." This confirms it as the mandatory first step.
3. Trailhead
Lightning Web Components Basics Module: The "Add Lightning Components to Visualforce Pages" unit demonstrates the complete pattern
showing the tag
followed by a script that uses $Lightning.use() to access a dependency app and $Lightning.createComponent() to instantiate the component. This reinforces that all three are part of the standard
required implementation.
Keep practicing
Take the free CRT-450 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CRT-450 practice questions
- Question 2A developer created a child Lightning web component nested inside a parent Lightning web …
- Question 4A developer needs to make a custom Lightning Web Component available in the Salesforce Cl…
- Question 6Given the following Apex statement: Account myAccount = [SELECT Id, Name FROM Account); W…
- Question 8Which action causes a before trigger to fire by default for Accounts?
- Question 9Universal Containers (UC) wants to lower its shipping cost while making the shipping proc…
- Question 10A custom picklist field, Pool Preference ¢, exists on a custom object. The picklist conta…
