SalesforceSalesforce DeveloperLightning Web ComponentsMedium
How do Lightning Web Components communicate with each other?
Suggested answer
Parent to child communication uses public properties and methods decorated with @api. Child to parent communication uses custom events that the child dispatches and the parent handles.
For components that are not in the same hierarchy, such as separate components on a Lightning page, I use Lightning Message Service, which works across the DOM and with Aura and Visualforce.
What interviewers look for
Look for the three patterns and when to use each. Good candidates mention event propagation options such as bubbles and composed. A pitfall is suggesting the older pubsub module for new work or directly manipulating other components' DOM.
Original practice content; 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.