PDI practice question 14 of 30

Which three resources in an Aura component can contain JavaScript functions? Choose 3 answers

Full set: 201 questions
Answer options
A: Style
B: Renderer Correct answer
C: Controller Correct answer
D: Design
E: Helper Correct answer
Correct Answer:
B. Renderer; C. Controller; E. Helper
Explanation

In the Aura Component framework, JavaScript functions are housed in specific client-side resources within a component's bundle. The Controller (controller.js) contains functions that handle user actions and events. The Helper (helper.js) contains reusable JavaScript logic that can be called from the controller or renderer, promoting code reuse. The Renderer (renderer.js) contains JavaScript functions to override default rendering behavior and manage the component's DOM manipulation during its lifecycle. These three resources are the designated places for client-side JavaScript logic.

Why Incorrect

A. Style: The Style (.css) resource contains CSS rules for component styling and does not execute JavaScript.
D. Design: The Design (.design) resource is an XML file that defines design-time attributes for tools like the Lightning App Builder, not JavaScript functions.

References

1. Lightning Aura Components Developer Guide, Component Bundle:

Controller: "A client-side controller contains the JavaScript that defines the functions for all of the component's actions." (See section: "Component Bundle")

Helper: "A client-side helper can be considered a component library that contains a repository of JavaScript functions that can be used by any of the component's JavaScript code." (See section: "Component Bundle")

Renderer: "A client-side renderer modifies the default rendering behavior of a component. A renderer file is a JavaScript resource..." (See section: "Component Bundle")

Style: "The style resource contains the CSS rules for the component." (See section: "Component Bundle")

Design: "The design resource is required for a component to be used in Lightning App Builder... The design resource is an XML file..." (See section: "Component Bundle")

2. Lightning Aura Components Developer Guide, JavaScript Controller:

"A component’s client-side controller is a JavaScript object in the component bundle... The controller contains the action handlers that respond to events." (See section: "Creating and Using Actions")

3. Lightning Aura Components Developer Guide, Sharing JavaScript Code in a Helper:

"Put reusable JavaScript functions in a helper to share the code across a component’s controller and renderer." (See section: "Sharing JavaScript Code in a Helper")

Scroll to Top