ES6 global import

有些话、适合烂在心里 提交于 2019-12-01 02:50:06

The other answer covers this, but not with valid ES6, so I'm adding my own. Make a central file to import your react components, in some central react.js file

export {default as React} from 'react';
export {default as Reflux} from 'reflux';
export {default as reactMixin} from 'react-mixin';

Then in the files where you need to use these three, you could do

import {React, Reflux, reactMixin} from './react';

to import all three into your component file.

Create a "base" that declares common imports, then you can import that one file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!