我想创建一个简单的react redux页面,我想在页面上显示数据。我创建了它,但是我遇到了一些错误。
我无法在app.js页面获取道具。
任何人都可以帮我吗?
答案 0 :(得分:0)
您必须绑定上下文以在函数中调用this
。
有很多方法可以做到这一点,要么将你的函数声明为箭头函数,即:
renderList = () => { some code }
或者在构造函数中绑定它:
constructor(props){
super(props);
this.renderList = this.renderList.bind(this);
}