我在一个项目中使用 react 并且 React.Component 类的导入没有问题。但是,当尝试导入不扩展任何内容的 vanilla es6 类时,它会失败。即使 eslint 编译没有问题。导入的类在构造函数中也是 null。
import Utils from "../../common/services/Utils";
componentWilReceiveProps(newProps){
Utils // here is null
}
class Utils {
test() {
// do nothing
}
}
export default Utils;