从其他文件重新导出默认导出的最佳方法是什么?
我想做这样的事情:
export Button from './Button/Button';
显然这不是有效的EcmaScript语法(但它曾用于较旧的Babel版本)。
因此我想import {Button} from 'components';
有没有更好的方法,也许是单行? ES6语法将被优先使用。
谢谢!
答案 0 :(得分:2)
您可以使用export { x as y }
语法:
export { default as Button } from './Button/Button';
我想做这样的事情:
export Button from './Button/Button';
此语法有第1阶段提案:https://github.com/leebyron/ecmascript-more-export-from