Do you have a interview on Aura Components recently, then this is for you. Get a hang of how your interview questions will be on Aura Components.

1. What is the purpose of <aura:method/> tag?
This tag is used to send data from the Parent Component to the Child Component.Which is the vice-versa of what component event does.

2. What is the purpose of helper file in an Aura Component?
It's always suggested that we follow Learn Controllers and Fat Helpers for better code maintenance, also, when we have multiple components in hierarchy the code in helper file can be shared by the other components in the hierarchy.

3. What is the major difference between Aura components and LWC? Why did salesforce had to comeup with LWC when Aura Components has been there in the industry since 6 years?
When Aura Components were published ES6 was not launched and since ES6 is launched a lot had changed in the JavaScript world and browsers also matured a lot.

The major problem with Aura Components is when a new feature is launched in ES6 that has to be ported to Aura Components if need be, where as in LWC once an update is released straight away we can use it in LWC.

In Aura Components we need to write Aura specific code and the platform generates native JS, where as in LWC we will write native JS and that will provide us significant performance boost.

4. Explain how data can be sent from Parent Component to Child Component?
Data can be sent from Parent to Child using Attributes.

5. How data can be sent from Child Components to Parent Component?
When data has to be sent from child to parent we need to make use of component event to send the data.

6. How many events do we have in Aura Components and what is their purpose?
There are three types of events ...

  • Component Events - This is used when data has to be sent from child component to parent component.
  • Application Events - This is use when data has to be sent from one component to another component which is not with in the hierarchy.
  • Standard Out of the Box Events - These are some events that are provided to us by the framework that we can make use of with out creating them. One example is 'Show Toast' event.

7. Can we call an Apex method that is not Aura Enabled?
No we cannot call an Apex method that is not Aura Enabled in Lightning.

8. What happens when we try to retun data types that are not Aura Enabled?

 @AuraEnabled
 public URL foobar(){

 }

We will get NULL. Data Type of the return type always has to be Aura Enabled.

9. Is data mutation bi-directional or uni-directional in Aura Components?
Yes! It is bi-directional in Aura Components and uni directional in LWC. In LWC in case we have to mutate or change the value of a property we need to send the new value to the parent, parent modifies it and sends the new value to the child.

10. Can we have an Aura Enabled method that is not static?
No we always should have the method as Aura Enabled, else it will throw an error.

11. How can we implement a form wizard in Aura Components? I don't want to show all the fields in a single form, any solution that you can think of?
We will display all the fields in the components and then we need to make use of $A.util.toggleClass or $A.util.addClass() and $A.util.removeClass() and we need to show the first three fields, hide the remaining fields, and then when users click on next first three fields has to be hidden and then 4,5,6th fields should be shown so on and so forth. Finally we will make use of a LDS methods or apex method to save the record.

12. How can I implement a piece of logic automatically after the components is instantiated?
By making using of
<aura:handler name="init" value="{! this }" action="{! c.doInit }"/>

13. How can I implement a piece of logic automatically after the components is rendered completely?
By making using of
<aura:handler name="render" value="{! this }" action="{! c.doRender }"/>

14. What all data types can be used for attributes in Aura Components?
Basic Types - String, Integer, Boolean, Decimal, Integer, Double, Date, DateTime, Long
Collection Types - Array, List, Map Set
Object Types - Object, SobjectApi Name

15. What's the tag used to loop over through list of records in Aura Components?

<aura:iteration items="" var="">
        
</aura:iteration>

16. What is the purpose of design file in a component?
We can give the administrators to option to set the values of the parameters using UI.

17. What is resource bundle in Aura Components?
When we create a component in Aura Components, it's not that we are creating a single file behind the scenes it creates 8 files. This helps us modularise the code, all the css code goes to the css file, documentation stuff goes to documentation code and etc. Put together all these 8 files is called resource bundle.

18. Can I create an Aura Component without css file?
No, it is not possible. We will not have any say when it comes to not creating these 8 files. It's part of the resource bundle, once a component is created all the 8 files will be automatically created.

19. What is the purpose of documentation file in Aura Components?
Just like how we have documentation for base components, we can generate standard documentation for our components also automatically by making using of a couple of tags. That’s the use of documentation file.

20. What is the purpose of implements attribute in aura:component/ tag?
When we use implements we are trying to extending the functionality of the component. By default all the components are headless, meaning, we need to put them in a record page, home page, lightning app etc to see the output, else we will not be able to see the output

By providing values to implements we can embed the component in the record page, lightning page, communities etc.

21. What are standard out of the box events?
These are some events that are provided to us by the framework that we can make use of with out creating them. One example is 'Show Toast' event.

22. What are platform events?
They are used to deliver custom notifications witn in salesforce and to external apps. Let’s say we want to send a notification along with data to external system about an order that got placed or if an external ERP system wants to send a notification to Salesforce then we will make use of platform events.

23. How can we navigate the user from one component to another component in Aura Component?
By making use of PageReferene Types concept and here we also need to implement isUrlAddressable for the component to navigate to destination component.

24. How can we plug a component in to the Lightning Record Page?
By implementing force:availableForRecordHome interface.

25. Can we display a component conditionally in a Lightning Record Page?
In Lightning App Builder we will have the option to display the component conditionally, we can make use of that.