![]() ![]() Use spread operator for adding additional attributes in data returned from apex For example, if we keep the name as MYComp it will be saved as mYComp.Īnd one more point, we need to mention the closing tags explicitly for lightning tags as well as while referencing components. If we start with an uppercase it will eventually be replaced with lowercase. ![]() Similar to kebab-case format, each capital letter is represented as hyphen(-) followed by the lowercase version.įor example, if the component name is m圜ompLWC, it is referred as: Īlso as a best practice, start the component name with lowercase. LWC follows kebab-case naming convention: Be extremely careful while naming Lightning Web Components. So,Ĭonst customEvt = new CustomEvent('onselect') Ĭonst customEvt = new CustomEvent('select') So, adding an additional ‘on’ at the start of the event name would create confusion. Avoid prefixing custom event names with ‘on’Īvoid prefixing custom event names with ‘on’: The event handler names start with on. Also do not use reserved keywords like ‘slot’, ‘part’, ‘is’. Be careful while naming variablesīe careful while naming variables: Do not start a property name with ‘on’, ‘aria’, ‘data’. Here are 20 Tips and Trick for Lightning web components with examples. Tips & Trick for Lightning Web Components
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |