react中console.log(this),this为空?
来源:互联网 发布:二手房增值税算法 编辑:程序博客网 时间:2024/06/18 15:25
因为个人debug的不良方式,喜欢把this打印出来, 发现的问题
如下:很有可能是因为您没有 构造方法
class ImgFigure extends React.Component {/* *imgFigure的點擊處理函數 */ handleClick(e){ console.log(this); this.props.inverse(); e.stopPropagation(); e.preventDefault(); }}
这种情况就写一个constructor把,es6之前叫做getInitial的方法
constructor(props) { super(props); this.handleClick = this.handleClick.bind(this);}
0 0
- react中console.log(this),this为空?
- this指针为空
- React实战-React中this的用法
- console.log(jQuery(this).find("i").css("visibility"));google的console控制台打印日志
- react系列-bind this
- react 中的this
- react this.props.children
- React的bind(this)
- React this.state
- React中的this
- this.getHibernateTemplate()空指针
- this.get_element .style为空或不是对象
- this.EditingArea为空或不是对象 (FCK)
- 检测this指针是否为空来提高健壮性
- Ext问题:this.mainbody.dom为空或不是对象
- this.store.autoCreated为空或不是对象
- Ext错误:this.config[...].width为空或不是对象
- 消息: 'this.get_element().style' 为空或不是对象
- 消失的数字
- 关于Adapter的The content of the adapter has changed问题分析
- 欢迎使用CSDN-markdown编辑器
- JAVA求学之路第十三天
- 《北大经典讲座》——谈读书
- react中console.log(this),this为空?
- bat文件运行java程序加载com.mysql.jdbc.driver方法
- Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/db.properties]
- Android开发中导入字体库
- 原生JS实现购物车结算
- Linux------可执行程序的装载
- 关于sizeof的一些小细节
- 子沐代码段——Flask+Mysql+Echarts可视化
- 出错处理APUE-1.7