Plat-Dev-301 practice question 9 of 10
Refer to the Aura component below: HTML<aura:component><aura:attribute name="contactInfo" type="Object"/><aura:attribute name="showContactInfo"…
Full set: 160 questionsRefer to the Aura component below: HTML
<aura:component>
<aura:attribute name="contactInfo" type="Object"/>
<aura:attribute name="showContactInfo" type="boolean" default="true"/>
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<aura:if isTrue="{!v.showContactInfo}">
<c:contactInfo value="{!v.contactInfo}"/>
</aura:if>
</aura:component>
A developer receives complaints that the component loads slowly. Which change can the developer
implement to make the component perform faster?
The component's performance issue stems from unconditionally rendering the child component on initial load because showContactInfo defaults to true. Changing the default to false implements lazy loading. The child component and its associated data processing will not be initiated until the showContactInfo attribute is explicitly changed to true, for example, by a user action. This defers the rendering and improves the initial load time of the parent component.
A. Moving the contents of the child component into the parent would likely worsen performance by increasing the parent's complexity and initial payload, preventing lazy loading.
B. Changing the attribute type from Object to Map is a data structure change that would not have a significant impact on the component's rendering performance.
1. Salesforce Aura Components Developer Guide, "Performance Best Practices for Aura Components", section "Use Lazy Instantiation for Components". (Explicitly recommends using aura:if with a default false condition to defer component creation).
2. Salesforce Aura Components Developer Guide, "Conditionally Displaying Content with aura:if". (Explains how aura:if adds or removes components from the DOM, which is the mechanism for lazy loading).
Keep practicing
Take the free Plat-Dev-301 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-301 practice questions
- Question 1Which use case can be performed only by using asynchronous Apex?
- Question 2The Account object has a field, Audit_Code__c, that is used to specify what type of audit…
- Question 3How should a developer verify that a specific Account record is being tested in a test cl…
- Question 4There is an Apex controller and a Visualforce page in an org that displays records with a…
- Question 5A developer created and tested a Visualforce page in their developer sandbox, but now rec…
- Question 6Refer to the code below: Lightning Web Component JS file JavaScript import {LightningElem…
