What is the NavigationMixin
found in NavigationMixin(LightningElement)
? Where is it defined? How can I write my own mixins?
1 Answer
Mix-ins are a fairly well-documented feature of many programming languages, including modern JavaScript/ES6. They are used to allow classes to inherit functionality from multiple other classes.
NavigationMixin
is a class defined in the lightning
namespace. It is documented here and here.
-
Thank you. I know what mixins are, but I had never seen the
Mixin(Base)
syntax. I thought it was something proprietary to SF/LWC. Now, I understand it's plain old JavaScript (although not well known, at least not to me). Dec 31, 2019 at 1:37