Is it possible to extend multiple lighting base web components?
Something like this:
import externalScripts from 'c/Scripts';
import { LightningElement, api } from 'lwc';
export default class Topics extends LightningElement, externalScripts{
@api name;
}
I want to use @track
, @api
but they are not working
Thanks!
Best Answer
That's not possible for prototypical inheritance. But you can use Mix-Ins to emulate multiple inheritances:
A function with a superclass as input and a subclass extending that superclass as output can be used to implement mix-ins in ECMAScript:
A class that uses these mix-ins can then be written like this:
Some additional resources: Mixins for Web Components