$A.createComponent() for lazy loading

If you have too many aura:if statements inside aura:iteration, you can transfer some logic to the controller to create markups conditionally using the $A.createComponents() API. The code snippet for this technique is shown, and, depending on the conditions, you can build the final component markup. Let's take a look at the code:

$A.createComponent(componentName, options, function(comp) {
var body = component.get("v.body");
body.push(comp);
component.set("v.body",cmp);
});

This method reduces the number of components and improves performance. However, you are still using the framework, and there is some rendering cost consumed from the framework.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.119.170