PDI · Question #160
What are three capabilities of the <ltng : require> tag when loading JavaScript resources in Aura components? Choose 3 answers
The correct answer is B. One-time loading for duplicate scripts C. Specifying loading order D. Loading scripts In parallel. The <ltng:require> tag in Aura components offers capabilities such as preventing duplicate script loading, enforcing a specific script execution order, and enabling parallel script loading for efficiency.
Question
What are three capabilities of the <ltng : require> tag when loading JavaScript resources in Aura components? Choose 3 answers
Options
- ALoading files from Documents
- BOne-time loading for duplicate scripts
- CSpecifying loading order
- DLoading scripts In parallel
- ELoading externally hosted scripts
How the community answered
(48 responses)- A2% (1)
- B94% (45)
- E4% (2)
Why each option
The `<ltng:require>` tag in Aura components offers capabilities such as preventing duplicate script loading, enforcing a specific script execution order, and enabling parallel script loading for efficiency.
The `<ltng:require>` tag loads JavaScript resources from Salesforce Static Resources, not from the Salesforce Documents object.
The `<ltng:require>` tag ensures that JavaScript files are loaded only once per page, even if requested multiple times, which prevents redundant downloads and potential conflicts.
Developers can specify the loading and execution order of dependent scripts using the `afterRender` attribute within `<ltng:require>`, which is critical for managing script dependencies.
The tag facilitates loading multiple JavaScript files in parallel, optimizing component load times by fetching resources concurrently.
The `<ltng:require>` tag is designed for loading JavaScript from Salesforce Static Resources and does not directly support loading externally hosted scripts for security and performance reasons.
Concept tested: `<ltng:require>` tag capabilities in Aura components.
Source: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_client_side_loading_external.htm
Topics
Community Discussion
No community discussion yet for this question.