Composition

You can add components within the body of another component. Composition enables you to build complex components from simpler building-block components.

Inheritance is allowed, but it isn’t recommended because composition is usually more effective. To share logic between components, use a module that contains only logic. See Additional JavaScript Files. If you do choose to use inheritance, note that it doesn’t work across namespaces under Lightning Locker. You must enable LWS to use inheritance across namespaces. You can’t extend the lightning namespace in either security architecture.

See Also