Skip to main content

Could you please help me to understand what is the use of Helper Javascript file in lightning aura bundle with some use cases

 

#Aura Component #Aura Lightning Components #Lightning Aura #Salesforce Developer #Salesforce Developers #Developer Beginner #Developers #Developer Tools #Salesforce Certified Platform Developer?

2 risposte
  1. 6 nov 2021, 06:20

    Basically, The controller is the JS file that gets requests from the Component now the first thing we do is write most of the logic in the helper file and the Controller just calls the method defined in the helper the reason is it makes code look cleaner but the main reason is now since you have a method in helper file if you want to call it again then you can call it multiple times from controller method so any function that should act as a reusable function you should define it in helper. any function that we define in controller can only accept 3 parameters in the same order component, event, helper. so it can't contain a normal function that expects dynamic values as Parameter that you can only do in helper file 

0/9000