何时使用export vs export默认?

时间:2016-01-19 04:13:33

标签: javascript

浏览GitHub上的项目后,在我看来exportexport default可以互换使用。我也知道当使用export default时,括号被省略。我想知道两个关键字之间是否存在其他差异?也许效率?或编码惯例?

据我所知: export

export function Directive () {}

要导入构造函数,我们需要为构造函数名称添加{ }

import { Directive } from './someDir'

而不是export default,我们不需要{ } ..即:

import Directive from './someDir'

0 个答案:

没有答案
相关问题