关于TypeError : React object is undefined on createElement
2017-12-05 20:06
483 查看
调试过程中遇到这个问题:
TypeError : React object is undefined on createElement
检查了数次没发现哪里的问题,最后终于找到原因。React的导入方式不对,很低级的错误,今后可能也有朋友像我一样粗心,为免走弯路也为提醒自己不要再犯这样的错误,所以记录一下。
现场还原:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201712/a66fe1f79155f8cc879d320a41945f8e)
原来的代码:
修改的地方:
前面也说过,关于“undefined is not unobject”之类的错误,检查导包是否正确,然后就是检查是否已经分离出来。关注更新,细心一点总没错。
TypeError : React object is undefined on createElement
检查了数次没发现哪里的问题,最后终于找到原因。React的导入方式不对,很低级的错误,今后可能也有朋友像我一样粗心,为免走弯路也为提醒自己不要再犯这样的错误,所以记录一下。
现场还原:
原来的代码:
// 数据展示和事件交互 'use strict'; import {React,Component}from 'react'; import {requireNativeComponent,View} from 'react-native'; import {PropTypes} from'prop-types'; ...
修改的地方:
import React,{Component}from 'react';
前面也说过,关于“undefined is not unobject”之类的错误,检查导包是否正确,然后就是检查是否已经分离出来。关注更新,细心一点总没错。
相关文章推荐
- 关于 "Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function" 的解决方案
- TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement.
- TypeError: 'WebElement' object is not iterable
- TypeError:'stepUp' called on an object that does not implement interface HTMLInputElement.
- 关于Uncaught TypeError: type is not a function at HTMLAnchorElement.onclick (indexjsp:71)的解决
- 关于STM32工程的错误,狗血错误。。。..\CMSIS\core_cm3.h(1087): error: #20: identifier "IRQn_Type" is undefined
- ajax传值时报错:TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement
- js报错“TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement”
- React.createElement: type should not be null, undefined, boolean, or number
- TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement
- TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement”
- weex打包js集成到Android Studio TypeError: undefined is not an object (evaluating 'o.indexOf')
- 关于import tensorflow as tf的错误:AttributeError: type object 'NewBase' has no attribute 'is_abstract'
- Python:TypeError: 'int' object is not callable
- 关于JavaScript一个错误 Uncaught TypeError: form.submit is not a function
- Python学习笔记:学习爬虫时遇到的问题TypeError: cannot use a string pattern on a bytes-like object 与解决办法
- JS TypeError: $.browser is undefined 解决办法
- 关于 error: Operation is not valid due to the current state of the object。
- TypeError:'NoneType' object is unsubscriptable
- UE报错:Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element'解决方案