top of page

Use of helper in Aura

Put functions that you want to reuse in the component’s helper. Helper functions also enable specialization of tasks, such as processing data and queueing server-side actions.

Eg:

/* helper */ ({ updateItem : function(component, item, callback) { // Update the items via a server-side action i.e calling apex method - saveItem var action = component.get("c.saveItem"); action.setParams({"item" : item}); // Set any optional callback and enqueue the action if (callback) { action.setCallback(this, callback); } $A.enqueueAction(action); } })

A helper function can be called from any JavaScript code in a component’s bundle, such as from a client-side controller or renderer.

Eg:

/* controller */ ({ newItemEvent: function(component, event, helper) {

//calling the helper function helper.updateItem(component, event.getParam("item")); } })

Recent Posts

See All
Use cases for Aura components

Accordion: Similar to menu items, clicking on an item displays its content. You can embed html tags or components in it. Check the link...

 
 
 
Events in Aura

Application Event An application event is fired from an instance of a component. All components that provide a handler for the...

 
 
 

Comments


Post: Blog2_Post

©2020 by SalesforceDemystified. Proudly created with Wix.com

bottom of page