LWCIntermediateeventscommunicationarchitecture
Design component communication patterns in LWC
Real World Scenario
Parent filter panel, data table, and summary chart on Opportunity page must stay synchronized without tight coupling.
Expected Answer
• Parent-to-child: @api properties and methods for controlled inputs
• Child-to-parent: CustomEvent with bubbles and composed for shadow DOM
• Sibling communication via Lightning Message Service pub/sub channels
• Avoid global window events—breaks encapsulation and testability
• Document event contracts: name, payload shape, when fired
• LMS for cross-DOM hierarchy including Aura coexistence during migration
• Minimize event chatter—batch state updates to reduce re-renders
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Main difference: use case and scale. Parent-to-child: @api properties and methods for controlled inputs. Child-to-parent: CustomEvent with bubbles and composed for shadow DOM. Pick based on your integration pattern and team capability. LMS is enterprise glue for sibling components—define channel catalog to prevent 50 ad-hoc channels. Balance speed of delivery with maintainability.
Architect Perspective
LMS is enterprise glue for sibling components—define channel catalog to prevent 50 ad-hoc channels.