Aura Components Interview Questions

Aura Components Interview questions will help you get a hang of how your next interview is going to be.

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

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.

What is the purpose of a 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 the hierarchy the code in the helper file can be shared by the other components in the hierarchy.

What is the major difference between Aura components and LWC?

Why did salesforce have to come up with LWC when Aura Components has been there in the industry for 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, whereas 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, whereas in LWC we will write native JS and that will provide us significant performance boost.

Explain how data can be sent from Parent Component to Child Component?

Data can be sent from Parent to Child using Attributes.

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 the component events to send the data.

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 the child component to the parent component.
  • Application Events - This is used when data has to be sent from one component to another component that is not within 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 without creating them. One example is the Show Toast event.

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.

What happens when we try to return data types that are not Aura Enabled?

 public URL foobar(){

Aura Enabled Apex method in Apex Class

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

Is data mutation bi-directional or uni-directional in Aura Components

Yes! It is bi-directional in Aura Components and unidirectional 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, the parent modifies it, and sends the new value to the child.

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.

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 an LDS method or apex method to save the record.

How can I implement a piece of logic automatically after the components are instantiated?

By making use of
<aura:handler name="init" value="{! this }" action="{! c.doInit }"/>

How can I implement a piece of logic automatically after the components are rendered completely?

By making use of
<aura:handler name="render" value="{! this }" action="{! c.doRender }"/>

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

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

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

<aura:iteration /> tag in Aura Framework

What is the purpose of a design file in a component?

We can give the administrators to option to set the values of the parameters using UI.

What is the 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. Putting together all these 8 files is called a resource bundle.

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.

What is the purpose of the 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 a couple of tags. That’s the use of documentation files.

What is the purpose of implementing attribute in <aura:component/> tag?

When we use implements we are trying to extend the functionality of the component. By default all the components are headless, meaning, we need to put them on a record page, the 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.

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 without creating them. One example is the Show Toast event.

What are platform events?

They are used to deliver custom notifications within salesforce and to external apps. Let’s say we want to send a notification along with data to an 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.

How can we navigate the user from one component to another component in Aura Component?

By making use of the PageReferene Types concept here we also need to implement isUrlAddressable for the component to navigate to the destination component.

How can we plug a component into the Lightning Record Page?

By implementing force:availableForRecordHome the interface.

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.

Hope this was helpful!

Grab your FREE course

I had put together a FREE course on Javascript that helps you master Lightning Web Components.

It just takes 2 minutes to finish the course and you will be able to feel the difference.

Javascript for Lightning Web Components