+ Start a Discussion
smriti sharan19smriti sharan19 

Named Exports in Lightning Web Component

Can we have named export in Lightning Web Component?

In ES6 module there are two ways of exporting module:
Default Export
Named Export
I am able to find deault export in lwc
export default class HelloWorld extends LightningElement {}
But I have not seen named export in LWC so want to know if they are used in lwc?

According to ES6
 There can be several named exports in a ES6 module. A module can export selected components using the syntax given below −
//using multiple export keyword
export component1
export component2
export componentN

AnudeepAnudeep (Salesforce Developers) 
Hi Smriti, 

Lightning Web Components JavaScript support includes:
ES6 (ECMAScript 2015) which means named exports is supported although there are no documented examples

usage is as follows
// Import a named export of a module.
import { property } from 'example';
// Import a named export to a different name,
import { property as exampleProperty } from 'example';

Let me know if this helps

Chandramohan Yetukuri 1Chandramohan Yetukuri 1
Could you please let me know what is the meaning of the below statement by tge way..

export default class HelloWorld extends LightningElement {}