PDI · Question #74
Which three code lines are required to create a Lightning component on a Visualforce page? Choose 3 answers
The correct answer is A. $Lightning.createComponent D. $Lightning.use E. <apex:includeLightning/>. Embedding Lightning components on a Visualforce page requires including the Lightning Experience Stylesheets, initializing the Lightning app, and then programmatically creating the component.
Question
Which three code lines are required to create a Lightning component on a Visualforce page? Choose 3 answers
Options
- A$Lightning.createComponent
- Bapex:slds/
- C$Lightning.useComponent
- D$Lightning.use
- Eapex:includeLightning/
How the community answered
(17 responses)- A94% (16)
- B6% (1)
Why each option
Embedding Lightning components on a Visualforce page requires including the Lightning Experience Stylesheets, initializing the Lightning app, and then programmatically creating the component.
`$Lightning.createComponent` is the JavaScript function used to dynamically create an instance of a Lightning component and insert it into a specified DOM element on the Visualforce page.
`<apex:slds/>` is used to include the Salesforce Lightning Design System (SLDS) stylesheets in a Visualforce page, but it is not strictly required for embedding a Lightning component itself.
`$Lightning.useComponent` is not a standard or valid function in the Lightning Out framework for embedding components on Visualforce pages.
`$Lightning.use()` is a JavaScript function that bootstraps the Lightning app framework on the Visualforce page, making Lightning components available for use. It typically specifies a Lightning dependency app.
`<apex:includeLightning/>` is a Visualforce component that injects the necessary JavaScript libraries and stylesheets to enable Lightning components within a Visualforce page.
Concept tested: Lightning Out for Visualforce
Source: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out_visualforce.htm
Topics
Community Discussion
No community discussion yet for this question.