50 LWC Lightning Web Component Interview Questions

50 LWC Lightning Web Component Interview Questions

On September 2, 2021, Posted by , In Interview Questions, With Comments Off on 50 LWC Lightning Web Component Interview Questions

50 Scenario based exclusive Salesforce Lightning Interview Questions with detailed Answers 2021 by CRS info Solutions with code snippets and unique answers.

Salesforce Lightning interview questions and answers CRS info solutions
Salesforce Lightning interview questions and answers CRS info Solutions
  1. What are the type of events into Salesforce Lightning component
    1. Application Event(Salesforce Document)
    2. Component Event
    3. System Event(Salesforce Document)
  2. What is the basic difference between Application Event and Component Event
    1. The major difference between application and component event is that component event is used in child to parent components and application event can be used throughout the application.
  3. Which interface needs to be implemented so that you can use lightning components as quick action.
    1. force:lightningQuickAction
  4. Which interface needs to be implemented so that you can use the lightning component as Tab like custom object and VF page.
    1. force:appHostable
  1. Can we use Lightning Components in the VF page?
    1. Yes, using lightning out functionality of the salesforce lightning component.
  2. How can we call the child component controller method from the parent component controller method?
    1. Yes, we can call using aura methods.
    2. Salesforce Document
  3. What are the different Lightning component bundles?
    1. Component
    2. Controller
    3. Helper
    4. Style
    5. Document
    6. Design
    7. SVG
    8. Renderer
    9. More Info Here(Salesforce Document)
Salesforce lightning interview questions Set 1
Salesforce lightning interview questions Set 1
  1. What is the use of Document and Renderer in lightning components?
    1. Document: – A description, sample code, and one or multiple references to example components
    2. Client-side renderer to override default rendering for a component.
  2. How to ensure FLS while working with Lightning Component?
    1. Lightning Data Services already ensures Field Level Security and we can also use into the Apex using isAccessible, isCreateable, isDeleteable, isCreateable and etc methods of Schema class.
  3. Can we use fieldSet in the lightning component?
    1. Yes. We can use Lightning:RecordForm and provide the list of the Fields in fields attribute. For more information Refer Here
  4. How to navigate from one component to another component.
    1. We can use force:navigateToComponent
    2. OR we can use lightning:navigation
  5. Can we use PageReference in Lightning Component?
    1. Yes
  6. How to call the Parent Component method from the child component without using events?
    1. Yes. By using aura:action but the recommended way is to use Component Event
  7. Can we use LWC inside Aura?
    1. Yes. We can use
  8. Can we use Aura Inside LWC?
    1. No. We can only use LWC inside Aura but not vice versa
  9. Is Lightning an MVC framework ?
    1. No, it’s a component-based framework.
  10. Which parts of Lightning Components are server-side and which are client-side ?
    1. Lightning Components use JavaScript on the client side and Apex on the server side.
  11. Is there any limit on how many components to have in one Application ?
    1. No
  12. Is Lightning Components replacing Visualforce ?
    1. No
  13. What is Aura? Why do we use the aura: namespace in the code ?
    1. Aura is the open source technology that powers Lightning Components. The aura: namespace contains all of the basic building blocks for defining components and applications.
  14. What is the difference between Visualforce Components and Lightning Components ?
    1. Visualforce components are page-centric and most of the work is done on the server. Lightning is designed from the component up, rather than having the concept of a page as its fundamental unit. Lightning Components are client-side centric, which makes them more dynamic and mobile friendly.
  15. Can we integrate Lightning components with another framework, such as Angular?
    1. Yes. we can include the working 3rd party code inside a Visualforce Page, embed the Visualforce Page inside a Lightning Component. This Lightning Component can be used as any other Lightning Component in various environments.
  16. What is use of @AuraEnabled annotation
    1. @AuraEnabled method is used to make any Apex Method for either Aura or LWC Component. @AuraEnabled Method must be static in nature.
  17. What If I try to make any DML inside a method which is having @AuraEnabled(cacheable=true)?
    1. If you try to make a DML inside the method then you will read only errors. cacheable=true makes the method read only.
  18. How to Create a Component Dynamically?
    1. Use $A.createComponent for creating the dynamic component see below code snippet.
    2. Component Code
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<p>Dynamically created button</p>
JS Code
doInit : function(cmp) {
"aura:id": "findableAuraId",
"label": "Press Me",
"onclick": cmp.getReference("c.handlePress")
function(newButton, status, errorMessage){
//Add the new button to the body array
if (status === "SUCCESS") {
var body = cmp.get("v.body");
cmp.set("v.body", body);
else if (status === "INCOMPLETE") {
console.log("No response from server or client is offline.")
// Show offline error
else if (status === "ERROR") {
console.log("Error: " + errorMessage);
// Show error message
handlePress : function(cmp) {
// Find the button by the aura:id value
console.log("button: " + cmp.find("findableAuraId"));
console.log("button pressed");
  1. Can we navigate to one component from another component?
    1. Yes. we can navigate for this we can use lightning:navigation. 
    2. Below is the code for the same
doInit : function(component, event, helper) {
navigate : function(component, event, helper) {
var nagigateLightning = component.find('navigate');
var pageReference = {
type: 'standard__objectPage',
attributes: {
objectApiName: 'Account',
actionName: 'list'
state: {
filterName: 'MyAccounts'
  1. Which Interface is used to make a component available inside Salesforce Digital Experience?
    Ans: forceCommunity:availableForAllPageTypes

Part – 2 | 50 LWC Lightning Web Component Interview Questions

Comments are closed.