Cannot read property 'createElement' of undefined

Posted suihang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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模块。

 

以上是关于Cannot read property 'createElement' of undefined的主要内容,如果未能解决你的问题,请参考以下文章

Uncaught TypeError: Cannot read property 'addEventListener'

Uncaught TypeError: Cannot read properties of undefined (reading 'getUserMedia')

axios报错: Cannot read property 'protocol' of undefined ....

解决报错Cannot read property 'forceUpdate' of undefined

VUE TypeError: Cannot read property 'validate' of undefined

Cannot read property 'map' of undefined