ExamGecko
Question list
Search
Search

Question 14 - Certified B2B Commerce Developer discussion

Report
Export

Which template will correctly display the details message only when areDetailsVisible becomes true given the following code in a Lightning Web Component?

A)

B)

C)

D)

A.
Option A
Answers
A.
Option A
B.
Option B
Answers
B.
Option B
C.
Option C
Answers
C.
Option C
D.
Option D
Answers
D.
Option D
Suggested answer: C

Explanation:

The template that will correctly display the details message only when areDetailsVisible becomes true given the following code in a Lightning Web Component is option C. Option C uses the if:true directive to conditionally render a template block based on the value of areDetailsVisible. If areDetailsVisible is true, the template block inside the <template if:true={areDetailsVisible}> tag will be rendered. Otherwise, it will be skipped. Option A is incorrect because it uses the if:false directive, which does the opposite of if:true. It renders the template block only when areDetailsVisible is false. Option B is incorrect because it uses an invalid syntax for the if directive. The if directive requires a colon (:) after the if keyword, not an equal sign (=). Option D is incorrect because it uses an invalid syntax for the template tag. The template tag requires a closing tag (</template>), not a self-closing tag (<template/>). Salesforce

Reference:Lightning Web Components Developer Guide: Conditional Rendering,Lightning Web Components Developer Guide: Template Syntax

asked 23/09/2024
Thomas Kincer
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first