Salesforce Lightning Interview Questions, most frequently asked.
Salesforce has been pushing Lightning Experience into the market aggressively these days. One of the immediate consequence that you will notice because of this is — every company expecting the Salesforce resource to have good hands-on knowledge on Lightning Experience.
So I curated a bunch of questions that get asked frequently in the interviews. Hope this helps!
What is Single Page Application(SPA) Architecture?
With normal traditional life cycle when a user sends a request(which is nothing but clicking a link/button or requesting a resource) there is a page reload which happens every time. With Single Page Application Architecture we will generate dynamic UI using JS for every request that we make rather than refreshing the whole page.
Is Lightning Experience a MVC framework?
No, Lightning Experience is component based framework and what it means is, we need to break down the whole functionality into small reusable pieces called components. Since we get access to Lightning resource bundle when we create one, we don’t have to bother about the code dependency between the components when we break a functionality into to pieces and move the components around.
What is Lightning resource bundle?
When we create new Lightning component a combination of 8 files will be created.
Component file
- We use this file to show UI stuff to users.Client side JS controller
- We will use this file to put the code to generate dynamic UI.Helper JS file
- Used to share snippet between multiple components and also repetitive code is put here.Style file
- We can apply custom styles here.Documentation file
- Just like how we get documentation to the standard components we can get documentation to our custom components.Renderer
- In case we want to perform some custom logic when the component renders, rerenders, after renders and unrenders we will use this file.Design file
- We can provide some design attributes which can be administrators and get custom functionality with in a matter of clicks.SVG file
- In case we want to include a SVG file into our component we will use this.
What’s the use of <aura:method />
?
In case we want to invoke an action handler on a child component from a parent component that’s when we will use <aura:method />
tag.
Can we have the Visualforce pages to inherit Lightning UI? If Yes, then how? If No, then how can we get it done.
We can make sure that the visualforce page inherits the Lightning tag and it's in sync with the Lightning Experience UI by adding a tag called <apex:slds />
. We can also use SLDS class names in the Visualforce pages once <apex:slds />
tag is included.
How many types of events do we have in Lightning Experience?
There are two types of events, Application Events and Component Events.
Component Events are used when we want to share resources from a child component to the direct parent component.
Application Events are used to share resources between any two components with in the application.
There is one more variant called Standard Out Of The Box eventsOOTB events which are in turn application events, which are given by the framework and one such mostly used OOTB event is showToast()
event.
Given a chance will you use force:navigateToComponent
tag or PageReference Types
and why?
It's better that we implement PageReference Types because most of the Standard OOTB events are deprecated. Also one of the pitfalls with force:navigateToComponent
is we cannot pass query string parameters where as with PageReference Types we can pass query string parameters too.
In case you are interested in stripping the query string parameters server side i.e in Apex, this post explain that.
Feel free to make use of the comment section in case you want me to answer other questions apart from these.