Salesforce Interview Questions & Answers Book is now available!

Grab Now

Aura

What's the use of helper.js file in Lightning Components aka Aura Components?

Let me walk you through the use of helper.js file in Lightning Component aka Aura Components.

By Teja, ex-Salesforce engineer · Updated April 11, 2021 · 1 min read

It's always a best practice to move the complete business logic in Lightning Components to a helper file and have the controller.js file just as a messenger.

There is a reason for that.

When a component is used (or embedded) multiple times in another component or when it's embedded multiple times in any of the lightning entities (Lightning Pages, Lightning Record Pages etc) then the helper.js file of the component(though embedded multiple times) is loaded only once which in-turn will be shared by the components.

So the resources used to load the same file multiple times is saved and response time can be reduced by a fraction of a second.

It basically enhances the user experience(UX).

Hope this is helpful!

Learn it by building it

Every course, every code repository, the discussion group and certificates of completion — one subscription.

Keep me in the loop!

Email me when a new episode is published (promise, I will not spam you)

You're signing up to receive emails from Salesforce Casts