Cannot read property 'createElement' of undefined

场景:

  架构:React+TS+DVA

    具体场景: 在将之前后缀为jsx的组件转化为tsx后缀的组件时,抛出Cannot read property 'createElement' of undefined

  

 解决方案:

  在tsconfig.json中添加配置

"esModuleInterop": true
"allowSyntheticDefaultImports": true

  作用:允许导入符合es6模块规范的CommonJS模块。

猜你喜欢

转载自www.cnblogs.com/suihang/p/11946372.html