LWC
A better component data flow
Understand parent-to-child properties, custom events, and communication boundaries.
By Vishal Verma · Reviewed October 5, 2026
Keep each component responsible for a clear piece of the interface. Decide which component owns the state before adding communication.
- Parent to child: expose public properties with @api and pass values through markup.
- Child to parent: dispatch a CustomEvent and let the parent respond.
- Unrelated components: consider Lightning Message Service where supported by the container.
Prefer a small event payload with only the data the listener needs. Avoid exposing mutable internal state. Design event propagation deliberately rather than enabling bubbling and composition everywhere.
Practice: build a contact list and a contact card. The parent loads the data. The card dispatches a selection event carrying the contact ID.