As a general implementation guidelines of LWC, we should be extending standard LWC elements. Examples are:
-
export default class MyComponent extends LightningElement
(Most used)
-
export default class MyComponent extends NavigationMixin(LightningElement)
-
export default class MyComponent extends LightningDatatable
(for using custom components in datatable.)
Refer HERE
Now, the question is when exactly should I extend other custom components? Something like
export default class MyComponent extends MyOtherComponent
And what are the considerations I should have while extending other custom components?
Best Answer
Not exactly an answer, but something I found a few months back on React. React is also a web framework like LWC.
Src: Composition Vs Inheritance in React
TBH I too never faced a scenario where I had to extend my Custom Component, In case of JS reusability, It can be done importing service libraries, and markup extension? are just parent markup containing child markup.
I know about a consideration that pchittum answered few months back, that you cannot pass parent property while creating child component via App Builder.