Timeline for Lightning Web Component (LWC) Class Definition Syntax
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 5, 2021 at 19:24 | comment | added | Bahman.A | Would you please share an article that explains mixins but with the same syntax used in LWC if you know of any? I'd really appreciate that!! | |
Oct 7, 2020 at 10:07 | comment | added | Mohith Shrivastava | @Phil W The article you shared is really neat and I have added as well to my answer! Mixins are hard to wrap head around specifically for someone not so familiar with object oriented programming! | |
Oct 7, 2020 at 10:06 | history | edited | Mohith Shrivastava | CC BY-SA 4.0 |
added 118 characters in body
|
Oct 7, 2020 at 10:02 | comment | added | Mohith Shrivastava | I think what would be ideal is a simple class or a service that once could just import it! Like all other modules like showtoast or lightning message service! It can also use decorators to pass in the context if needed! Using mixins, the syntax is no more elegant! | |
Oct 7, 2020 at 9:58 | comment | added | Phil W | I didn't point to that article in my comment because the syntax used doesn't align with that shown in LWCs. The reason to use a mixin is because you may have a custom hierarchy of LWC classes, rooted at LightningElement then need to add navigation to a new sub-class. If you use regular inheritance you can't do this without changing the root of the whole hierarchy to allow for navigation. I do think the alternative is to have a purely "external" navigation service (one not incorporated into your inheritance) to which you pass your element if that service needs to examine its state. | |
Oct 7, 2020 at 9:47 | history | answered | Mohith Shrivastava | CC BY-SA 4.0 |