// Three different export styles
export foo;
export default foo;
export = foo;
// The three matching import styles
import {foo} from 'blah';
import foo from 'blah';
import * as foo from 'blah';
/*
Since export default is used to declare a fallback value for a module or
file, you can only have one value be a default export in each module or
file. Additionally, you cannot use export default with var, let, or const.
*/
// named function
export default function add(x, y) {
return x + y;
}
// anonymous function
export default function(x, y) {
return x + y;
}
// Default exports
export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };