nerdexam
Salesforce

PDI · Question #23

A developer is creating an app that contains multiple Lightning web components. One of the child components is used for navigation purposes. When a user click a button called.. component, the parent c

The correct answer is D. Create a custom event.. Child Lightning Web Components communicate with parent components by dispatching custom events, which the parent then listens for and handles.

Submitted by brentm· Apr 18, 2026User Interface

Question

A developer is creating an app that contains multiple Lightning web components. One of the child components is used for navigation purposes. When a user click a button called.. component, the parent component must be alerted so it can navigate to the next page. How should this be accomplished?

Options

  • AFire a notification.
  • BUpdate a property on the parent.
  • CCall a method in the Apex controller.
  • DCreate a custom event.

How the community answered

(15 responses)
  • C
    7% (1)
  • D
    93% (14)

Why each option

Child Lightning Web Components communicate with parent components by dispatching custom events, which the parent then listens for and handles.

AFire a notification.

Firing a notification typically refers to showing a toast message to the user, not a direct programmatic communication channel between two components for internal application logic.

BUpdate a property on the parent.

Child components cannot directly update properties on a parent component; properties flow unidirectionally from parent to child in Lightning Web Components.

CCall a method in the Apex controller.

Calling a method in the Apex controller handles server-side operations and database interactions, but it does not facilitate direct communication between client-side Lightning web components.

DCreate a custom event.Correct

To alert a parent component from a child component in LWC, the child component should dispatch a custom event, which the parent component then registers a listener for and handles to trigger its navigation logic.

Concept tested: LWC Child-to-Parent Communication

Source: https://developer.salesforce.com/docs/component-library.en-us.lwc.meta/lwc/lwc_events_create_dispatch.htm

Topics

#Lightning Web Components#Custom Events#Child-to-Parent Communication#Inter-component Communication

Community Discussion

No community discussion yet for this question.

Full PDI Practice