没有收到app.js中的道具

时间:2017-06-01 08:16:51

标签: reactjs redux react-redux

我想创建一个简单的react redux页面,我想在页面上显示数据。我创建了它,但是我遇到了一些错误。

我无法在app.js页面获取道具。

任何人都可以帮我吗?

1 个答案:

答案 0 :(得分:0)

您必须绑定上下文以在函数中调用this。 有很多方法可以做到这一点,要么将你的函数声明为箭头函数,即: renderList = () => { some code } 或者在构造函数中绑定它:

constructor(props){
   super(props);
   this.renderList = this.renderList.bind(this);
}