Courseiva
User Interface →hardMultiple Choice

SF-PD2 User Interface Practice Question

A developer is creating a Lightning Web Component that must expose a public property so that a parent Aura component can pass a record ID into it. The LWC is embedded inside the Aura component using aura:component with an attribute. Which decorator and configuration should the developer use on the LWC property?

⚠ Common exam trap

Watch out — candidates often confuse reactivity decorators like @track with the public API decorator @api, when only @api exposes a property to a parent component.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Decorate the property with @api and define it as a public property in the LWC's .js file.

To allow an Aura parent to pass data into an LWC child, the LWC property must be part of its public API. The @api decorator makes a property public and settable from the parent's markup or JavaScript. When the Aura component uses an attribute with the same name, the framework maps it to the public property. Without @api, the property remains private and the parent cannot set it.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Decorate the property with @track and define a getter and setter in the LWC's .js file.

    Why it's wrong here

    @track is used to make changes to an object's fields reactive for re-rendering; it does not make a property public. A parent Aura component cannot set a @track property because it is not exposed on the component's public API. Using @track here would leave the record ID inaccessible to the parent, so the component would not receive the value.

  • ✗

    Decorate the property with @wire and import the record ID using lightning/uiRecordApi.

    Why it's wrong here

    @wire is for provisioning data from a wire adapter, not for exposing a public property. A parent component cannot set a wired property as an attribute. While getRecord could retrieve a record using an ID, the ID itself must first be passed in through a public property, so this does not solve the parent-to-child communication requirement.

  • ✗

    Define the property without any decorator and rely on the Aura component to set it via aura:attribute.

    Why it's wrong here

    In LWC, properties are private by default and are not part of the public API unless decorated with @api. An undecorated property cannot be set by a parent Aura component through an attribute. The Aura component's aura:attribute only maps to public LWC properties, so this approach would silently fail to pass the record ID.

  • ✓

    Decorate the property with @api and define it as a public property in the LWC's .js file.

    Why this is correct

    @api exposes a property as public, allowing parent components—including Aura components—to set it via an attribute in markup or programmatically. When an Aura component nests an LWC, the attribute name maps to the public property. This is the documented way to pass data from Aura to LWC and is required for the record ID to be available in the child.

About these practice questions

One of 226 original SF-PD2 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Salesforce exam blueprint

This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.