我认为问题在于绑定:
constructor(props){ super(props); this.goBack = this.goBack.bind(this); // i think you are missing this}goBack(){ this.props.history.goBack();}.....<button onClick={this.goBack}>Go Back</button>
正如我在发布代码之前所假设的那样:
constructor(props) { super(props); this.handleNext = this.handleNext.bind(this); this.handleBack = this.handleBack.bind(this); // you are missing this line}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)