Lightning Web Components and Aura components can work together, allowing you to migrate gradually and leverage existing Aura components while building new features with LWC.
Component Composition
You can compose components across frameworks in both directions.
Embed LWC in Aura
Aura components can contain Lightning Web Components using the standard component syntax.
auraEmbeddedLWC.cmp:
auraEmbeddedLWCController.js:
contactList.js (LWC):
You cannot embed Aura components inside Lightning Web Components. Communication must flow from LWC (child) to Aura (parent) or through Lightning Message Service.
Event Communication
LWC to Aura Events
Lightning Web Components dispatch standard DOM events that Aura can handle.
LWC Child Component:
Aura Parent Component:
Aura Controller:
Using Lightning Message Service
For components that aren’t in a parent-child relationship, use Lightning Message Service.
LWC Publisher:
Aura Subscriber:
Aura Controller:
Aura Publisher:
LWC Subscriber:
Sharing Apex Controllers
Both Aura and LWC can use the same Apex controllers.
Apex Controller:
LWC Usage:
Aura Usage:
Public Properties
Passing Data from Aura to LWC
Use public properties decorated with @api to pass data from Aura to LWC.
LWC Component:
Aura Component:
Aura Controller:
Navigation Considerations
Both frameworks can use navigation, but there are differences.
LWC Navigation
Aura Navigation
Migration Strategies
Gradual Migration
- Start with leaf components: Migrate the smallest, most isolated components first
- Embed LWC in Aura: Place new LWC components inside existing Aura containers
- Use LMS for communication: Connect new LWC with existing Aura using Lightning Message Service
- Migrate parent containers last: Once children are LWC, migrate the parent components
Shared Utilities
Create utility functions that work in both frameworks:
LWC Usage:
Aura Usage:
Best Practices
Keep Event Contracts Simple
Use LMS for Cross-Framework Communication
Prefer Lightning Message Service over component events for Aura-LWC communication:
Document Public APIs
Clearly document which properties and methods are intended for cross-framework use:
Test Both Frameworks
Test your components in both LWC and Aura contexts:
Common Pitfalls
Event Naming
Aura expects on prefix for event handlers:
Event Bubbling
Ensure events bubble and are composed:
Lifecycle Differences
Be aware of lifecycle hook differences:
- Aura:
init, render, afterRender, rerender, unrender
- LWC:
constructor, connectedCallback, renderedCallback, disconnectedCallback