ExamGecko
Ask Question

Salesforce Certified B2B Commerce Developer Practice Test 4

00:00:00
Show Answer
Report Issue   Restart test

Question 1 / 40

Northern Tail Outfitters (NTO) is converting an existing aura component into a Lightning Web Component. The aura component has the following source code:

Salesforce Certified B2B Commerce Developer image Question 121 59598 09232024001811000000

What is the equivalent of this code in a Lightning Web Component?

A)

Salesforce Certified B2B Commerce Developer image Question 121 59598 09232024001811000000

B)

Salesforce Certified B2B Commerce Developer image Question 121 59598 09232024001811000000

C)

Salesforce Certified B2B Commerce Developer image Question 121 59598 09232024001811000000

D)

Salesforce Certified B2B Commerce Developer image Question 121 59598 09232024001811000000

Option A
Option A
Option B
Option B
Option C
Option C
Option D
Option D
Comment (0)
Suggested answer: B
Explanation:

The equivalent of this code in a Lightning web component is option B. Option B uses the @api decorator to expose firstName as a public property of the Lightning web component and communicate it with other components or services. The @api decorator is a decorator that marks a property or method as public, which means that it can be accessed by other components or services that use or consume this component. The @api decorator also makes the property reactive, which means that it can track changes and update the component accordingly. In option B, firstName is exposed as a public property using the @api decorator and passed to the child element using an attribute. Option A is incorrect because it uses an invalid syntax for exposing firstName as a public property. The @api decorator should be used before the property declaration, not after it. Option C is incorrect because it uses an invalid syntax for exposing firstName as a public property. The @api decorator should be used with parentheses, not without them. Option D is incorrect because it uses an invalid syntax for exposing firstName as a public property. The @api decorator should be used with camel case, not with hyphens. Salesforce

Reference: Lightning Web Components Developer Guide: Communicate with Properties, Lightning Web Components Developer Guide: Decorators

asked 23/09/2024
Vincent Scotti
38 questions