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 questions
Answer options
A:

A. <apex includeLightning />

Correct answer
B:

B. $LightningcreateComponent

Correct answer
C:

C. $Lightning,use

Correct answer
D:

D. <apexslds/>

E:

E. #Lightning,useComponent

Correct Answer:
A. A. <apex includeLightning />; B. B. $LightningcreateComponent; C. C. $Lightning,use
Explanation

To 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.

Why Incorrect

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.

References

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.

Scroll to Top