We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
Salesforce Lightning Web
Component (LWC)
Interview Questions
Rupom Chakraborty
Sr.Solution Architect
Shyamla Plaza, Behind Mythrivanam,
Ameerpet , Hyderabad, Telangana State, India
RELL)
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 86868642861. What is Aura Framework?
Aura is an open source framework developed by Salesforce. It is a component-based
framework to develop Ul components.
2. What is Lightning Framework?
Lightning Framework is based on Aura Framework to design and develop Salesforce
Aura components. Lightning framework is also developed by Salesforce, but unlike
Aura Framework, it is not open source.
3. In which Salesforce release, Lightning Components were introduced?
Lightning was introduced in Salesforce Winter 15 release.
4. How to create a Lightning Web Component?
you cannot create LWC directly from your developer console. You need to SFDX or
MS Visual Code to create your lightning component.
5. Is it Work Together with Lightning Web Components and Aura Components?
Yes, Lightning web components and aure components work together without any
issues. Aura components can contain Lightning web components, but Lightning web
components can't contain aura components.
6. 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.
7. What is a @api decorator in js file?
Itis used to expose the public property of a web component. this property can use in
it's parent component.
8. What is a @wire decorator in js file?
To access Salesforce data (calling an apex method), Lightning web components use a
reactive wire service.
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 86868642869.What is Web Stack?
Collection of software applications needed for the Web Development can be called
as Web Stack.
It includes -
* Operation System
* Database
* Business Logic
* Web Server
10. What is rendering?
The process of converting HTML tags to meaningful readable web page with the
browser rendering engine.
11. What are the Standard Elements?
The elements provided in HTML library. We can also create custom element as per
the requirement which won't be part of standard HTML library.
12. What is event?
When the page load completes or user perform mouse or keyboard operation events
will trigger which can used to execute the javaScript.
13. What is Module?
A module is a javaScript file.
Ina module we define variables and functions which can be exposed to other
module by using export” directive.
To use the variables and functions of the other module we need to import other
module by using "import" directive.
The reason of using module is to decompose the logic. Instead of making all the
functions available within the same file, if they maintain the functions in different
files, based on the need we can import the corresponding module.
14. What is Directive?
It is a token which is having specific behavior.
Example: export, import
It modifies the behavior of an existing element by assigning value and responding
to change events
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428615. What is Decorator?
It is a function which is having predefined functionality.
Syntax: @DecoratorName
Similar to annotations in apex class.
16. What is Shadow DOM?
It is just a normal DOM except the separate behavior in relation to the rest of the
page.It won't be having conflicts with the styles which applied to the rest of the page.
It maintains in a separate DOM tree. (Alternative to iframe)
17. What are the Custom Elements?
Custom elements can be created to extend HTML and define our own tags.
18. What is template?
Itis a reusable structure in the HTML page but it won't be rendered until we refer it
in the javaScript.
19. What is Slot?
Itis a place holder in template and the content can be replaced based on the need
20. What are the Web Components?
It holds collection of web platform APIs and allows you to create custom functionality
which can be used in Web Pages.
21. What are the Lightning Web Components?
Lightning Web Components uses core Web Components standards. Lightning web
components are custom HTML elements built using HTML and modern JavaScript.
22. What is Classiin javaScript?
A class is a type of function, but instead of using the keyword function to initiate it,
we use the keyword class, and the properties is assigned inside a constructor()
method.
23. 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
24. Explain the Lightning Web Component Bundle?
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286LWC 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.
25. Explain CSS in Lightning Web Component Bundle?
We can also create a .css file for styling purpose and We can also create SVG file for
the purpose of displaying icon.
26. 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.
27. How to iterate over an array in HTML file?
We can make use of foreach directive and iterator directive.
foreach directive:
foreach directive is used to render an array. To render an array add the for:each
directive to a nested template tag, for:item Is used to access the current item,
for:index is used to access the current index.
Iterator directive:
If you have the requirement to access the first and the last element in the list use the
iterator directive.
28. What are the types of decorators in lightning web components?
We have 3 Decorators in Lightning Web Components.
1) @api
2) @track
3) @wire
29. Explain all threedeeerators in lightning web components?
‘See course material for answers
30%\What is the file structure of Lightning Web Components
myComponent folder
myComponent. html
myComponent.js
myComponent.js-meta.xml
myComponent.css
myComponent.svg
The folder and its files must follow these naming rules.
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286+ Can‘t contain a hyphen (dash)
+ Must begin with a lowercase letter
+ Can‘t include whitespace
+ contain only alphanumeric or underscore characters
+ Can‘t end with an underscore
* Must be unique in the namespace
+ Can‘t contain two consecutive underscores
31. How can you display components HTML conditionally
To render HTML conditionally, add the if:true |false directive to a
nested tag that encloses the conditional content.
32. How we can bind data in LWC
In the template, surround the property with curly braces, {property}. To compute a
value for the property, use a JavaScript getter in the JavaScript class, get property/)().
In the template, the property can be a JavaScript identifier (for example, person) or
dot notation that accesses a property from an object (person.firstName). LWC
doesn’t allow computed expressions like person[2].namel‘John’]. Don’t add spaces
around the property, for example, { data } is not valid HTML
33. How we can pass data from HTML toJs controller?
We can use the onchange attribute to listen for a change to its value. When the value
changes, the handleChange function in the JavaScript file executes.
34. How we can iterate ist imLightning Web Component (LWC)
We have two options available here.
for:each
When using the for:each directive, use for:item="currentitem" to access the current
item. This example doesn’t use it, but to access the current item’s index,
use for:index="index".
Iterator
To apply a special behavior to the first or last item in a list, use
the iterator directive, iterator:iteratorName={array}. Use the iterator directive on
a template tag.
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Use iteratorName to access these properties:
* value—The value of the item in the list. Use this property to access the properties
of the array. For example, /teratorName.value.propertyName.
+ index—The index of the item in the list.
* first—A boolean value indicating whether this item is the first item in the list.
+ last—A boolean value indicating whether this item is the last item in the list.
35. Can we display multiple templates
Yes we can, We can import multiple HTML templates and write business logic that
renders them conditionally. This pattern is similar to the code splitting used in some
JavaScript frameworks.
36. What are the public properties in Lightning Web Component
Public properties are reactive. If the value of a public property changes, the
component rerenders. To expose a public property, decorate a field with @api. Public
properties define the API for a component
37. How to set Property from Parent componentyto child component
To communicate down the containment hierarchy, an owner can set a property on a
child component. An attribute in HTML turns into a property assignment in
JavaScript.
38. How we can pass data fromparent component to child component
LWC support one way data transfer from parent to child. A non-primitive value (like an
object or array) passed to a component Is read-only. So the component cannot change
the content of the object or array. As a result if the component tries to change the
content, we will get errors in console.
39. Can we,have Pagination in LWC?
Yes, by using Server side controllers with Ofset in SOQL Query
40. Explain lookup in LWC
There are 2 Lightning web component.
1. lwcLookup - Contain actual code to fetch records and display as lookup.
2. lookupContainer - Shows how to call |wcLookup and it's properties.
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286Question Only}
Refer to Course Material for Answers and Related Topics:
1. What is a Lightning Web Components?
02. What are the advantages of using LWC over Lightning components?
03. What is Shadow DOM in LWC?
04. What is ES Module in LWC ?
05. Callout some differences between AURA and LWC?
06. When do you choose to use LWC ?
07. How will you choose to develop a component in LWC or AURA?
08. Which are the features supported by LWC?
09. Name few Unsupported features of LWC
10.What are the prerequisite of setting up LWC Dev Env.
11. Which tool do we use to develop LWC?
12. What is the role of SFDX in LWC?
13. Why we need Extension Pack in LWC Development?
14. How do you deploy LWC Component from MS VS Code?
15. What is Dev Hub and whats its use?
16. What is Scratch Org?
17. What is the use and purpose of scratch org in LWC?
Capital Info Solutions
Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428618. What is the max validity of a scratch org?
19. How many Scratch org can you create?
20. Who creates scratch org in Realtime?
21. What is LWC Bundle?
22. What are the elements of LWC Bundle and Explain them?
23. What is the use of HTML element of LWC Bundle?
24. What is the use of JS element in LWC Bundle?
25. What is the use of JS-Meta.xml element in LWC Bundle?
26. What is target in LWC js-meta.xml ?
27. How will you add custom CSS in LWC?
28. What is public property in LWC ?
29. What is @api and whats is its use ?
30. When do you use @api?
31.What is @track and whats is its use ?
32. When do you use @track?
33.What is @wire and whats is its use ?
34. When do you use @wire?
35. What is the difference between @api & @track ?
36. What are the different ways you can access Salesforce data in LWC?
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428637.
38.
39.
40.
41.
42.
43,
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
What are record forms? How many type of recordforms are available?
When do you use recordforms?
What type of service is @wire?
Explain @wire syntax
Can you wire a function or a property?
What is dynamic parameter in @wire?
Where and how you use dynamic parameter in wire service?
What is getListUi in wire ?
What is the purpose of getPickListValues in wire ?
What is the difference between getRecord and GetRecordUi?
What are the different ways you can call server side controller?
Why do we use @AuraEnabled in a method?
Can you use multiple @AuraEnabled for multiple method?
What do you understand by calling an apex method Imperatively?
What the syntax for calling an apex method Imper:
ely?
What is LWC Event?
Explain LWC event Flow
How do you create and Dispatch event in LWC?
How do you handle event in LWC?
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428656. What is difference between AURA Event and LWC Event?
57. How different is LWC Event Handling to AURA Event handlining?
58. What is Decelerative Event Handling?
59. What is programmatically event handling?
60. Explain LWC Event propagation
61. What is bubbles in LWC ?
62. How do you control LWC Event propagation?
in LWC event?
63. What the use of compose
64. How do you communicate between LWC Components?
65.What is Singleton ?
65.What is PubSub?
67. Explain subscribing and Unsubscribing in Event communication.
68. Explain LWC event best practices used
69. What is LWC Life cycle hook?
70. What is super and whats the use of super in LWC ?
71. Does Super has return statement?
72. What is a constructor in LWC?
73. Explain the use and need of a Constructor in LWC
74. What are the limitations of constructors in LWC?
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428675.
76.
7
78.
79
80.
81.
82.
83.
84.
85.
86.
87.
88.
89,
90.
91
92.
93.
Callout few action that cannot be implemented with Constructor in LWC
What is callback) in LWC?
What is Error and Data is LWC and whats is use/purpose ?
How can you call a LWC outside Lightning framework ?
Can you access/call LWC component in VF Framework?
What is lightningout?
What is the use of lightning.use and lightning.create?
How do you debug LWC program?
Does Aura & LWC can coexist in same env.?
What is coexistence strategy? Explain
ion?
What is Nested compo:
What do you mean by Side-By-Side composition?
How do you perform testing in LWC?
What is jest in LWC? And explain its use.
Explain LWC Testing steps
How can you migrate a AURA component to LWC?
How will you choose/decide which AURA component to migrate?
What is lightning locker in LWC?
Can you calloutout external endpoint url from LWC?
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 868686428694.How can you make API Call from LWC?
95. Explain continuation in LWC.
96. Explain few continuation limits
97. How can you deploy a LWC component to a Tab or as Standalone App?
98. What are deployment tools of LWC?
99. How do you migrate LWC component from Sandbox to Production?
100. Explain few issues and challenges you faced using LWC in your work
Material Authored, Written and Prepared by
RUPOM CHAKRABORTY
Certified SFDC Sol. Architect (Lightning & LWC)
Sl Ra Ue UCL Lae
Decl MCCUE CCM ely
ae -LB- |v e1)
RUPOM CHAKRABORTY
Capital Info Solutions
‘Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286