Suggested answer

Parent to Child: Use @api properties on the child component. The parent sets them as HTML attributes: <c-child record-id={recordId}></c-child>. The child declares: @api recordId;. You can also call child @api methods from the parent using template refs. Child to Parent: The child dispatches a custom event: this.dispatchEvent(new CustomEvent('myevent', { detail: payload })); The parent listens: <c-child onmyevent={handleEvent}></c-child>. For unrelated components (siblings or different trees), use the Lightning Message Service (LMS) — publish/subscribe via a Message Channel. This is the recommended alternative to Aura custom events between unrelated components.

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.