export 和 export default 的区别

export 方式导出时,在导入时需要加{};

export default 方式导出时,在导入时不需要加{};

示例:

/*export 方式(具名)导出*/
//a.js
export {actions,reducer,view};

//b.js
import {actions,reducer,view} from 'a.js'
/*export default 默认方式导出*/
//a.js
export default {actions,reducer,view};

//b.js
import component from 'a.js';
const actions = component.actions;
const reducer = component.reducer;
const view = component.view;

results matching ""

    No results matching ""