Sales force Web Lightning Interview questions

Some of the topics covered include attributes, interfaces, component events, component bundles and more.Interested in more Developer interview questions?

1. Where we can use Lightning Components?

We can use Lightning Components in the following places:
• Drag-and-drop Components in the Lightning App Builder and Community Builder.
• Add Lightning Components to Lightning Pages.
• Add Lightning Components to Lightning Experience Record Pages.
• Launch a Lightning Component as a Quick Action
• Override Standard Actions with Lightning Components
• Create Stand-Alone Apps

2. What is LWC (Lightning Web Components)?

As of now, we have built a lightning component using the “Aura Components model”. we can also build a lightning component using the “Lightning Web Components model”. Lightning Web Components are custom HTML elements build using the HTML Elements and modern Javascript. We can build components using any of the models and can place these components on the same lightning page. For developing LWC we require “Salesforce Extensions for Visual Studio Code” and for deploying LWC from an org we require “Salesforce CLI”.

Aura Components make use of own custom component model, custom templates, custom components, etc while LWC is built on web standards and it makes use of web components, templates, custom elements which we have in web standards. Both the Aura component, LWC make use of Security, LDS and Base lightning components.

Important points to note:

1. Aura component and LWC can exist on the same lightning page.
2.  Aura component can include LWC

3. How to render the HTML file conditionally?

If we want to render HTML conditionally we can make use of if:true={propertyName},if:false={propertyName} in nested template tag.

4. How can you create Lightning Record Pages in Salesforce, and what are the different types?

We can make use of Lightning App Builder for creating Lightning Record Pages, to create the following three types of pages:
• App Page
• Home Page
• Record Page

5. What options are there for Lightning Record Page assignment?

“Lightning Pages” can be assigned at three different levels:
• The org default
• App default – this overrides the assignment done at the org level
• App, record type, profile – this overrides the assignment done at org level and at the App level

6. What are attributes? What are their required parameters?

Attributes are variables which are used to store values. We specify the Name, Type, Default, Description, Access in the attribute definition. Only Name and Type are required parameters in the attribute definition, for example:
1 <aura:attribute name=”firstName” type=”String”/>
2) What is Scratch org?

Scratch org is a disposable Salesforce org used for development and testing.
Scratch org can be created for a maximum of 30 days after which scratch org gets deactivated. The default duration for Scratch org is 7 days.

7. What are the types of attributes that we can use to store values?

We can use different types of attributes, listed below:
• String
• Integer
• Boolean
• Date
• Datetime
• Double
• Decimal
• Long
• Array
• List
• Set
• Map
• Standard object attribute – example: <aura:attribute name=”contactObj” type=”Contact”
• Custom object attribute – example A: aura:attribute name=”customObjectList” type=”customObject__c[]”/>OR example B: <aura:attribute name=”customObject” type=”customObject__c”/>

8. Explain the Lightning Web Component Bundle?

LWC bundle contains an HTML file, a JavaScript file, and a metadata configuration file
and these files are created once we create a Lightning web component.

We can also create a .css file for styling purpose and We can also create SVG file for the purpose of displaying icon.

9. How to invoke/call child lightning web component function from parent lightning web component?

In our project requirements we may get a situation to call Child Lightning web component function from corresponding parent Lwc component when some event occurs like button click.
If we want to call child component function then

 Child LWC component function should be public (decorated with @api).
 On parent function we need to get child component by name(using template.querySelector) and then we should invoke child function (We should give same function name defined in child).

10. What is a @track decorator in js file?

It will keep track of the property’s value changes. This decorator is used to make a property private and which helps to re-render the component when the property value is changed.

11. What is a @api decorator in js file?

a. It is used to expose the public property of a web component. this property can use in it’s parent component.
6) What are the types of decorators in lightning web components?

We have 3 Decorators in Lightning Web Components.

1) @api
2) @track
3) @wire

12. Explain all three decorators in lightning web components?

Refer to the below link for an explanation.

https://www.sfdc-lightning.com/2020/01/decorators-in-lightning-web-components.html.

13.  How do you build Lightning Components?

We can build Lightning Components using two programming models: the Lightning Web Components model, and the original Aura Components model.

comment 44


  1. Omar Elter

    Heya! I’m at work surfing around your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the excellent work!

    Reply

leave your comment


Your email address will not be published. Required fields are marked *