저는 반응과 반응 라우터가 새로 도입되었습니다.반응 라우터 "정의되지 않은 '푸시'속성을 읽을 수 없습니다.
반응이있는 문제는 내 응용 프로그램의 일부 페이지에서 반응 라우터가 작동하고 일부에서 다음과 같은 오류가 발생합니다. "속성 '푸시'가 정의되지 않음 '을 읽을 수 없습니다. 내가 사용하고
은 0.14.1
내 라우팅 코드는 다음과 같습니다 반응 :
render(
<Router history={hashHistory}>
<Route path="/" component={Loginpanel}/>
<Route path="Index" component={Index}/>
<Route path="Form" component={Form} />
<Route path="Checkindex" component={Index}/>
<Route path="Signup" component={Signup}/>
<Route path="Admin" component={Admin}/>
<Route path="AdminEditDetails" component={AdminEditDetails}/>
<Route path="AdminDetails" component={AdminDetails}/>
</Router>,
document.getElementById('js-main'));
내 구성 요소는 지금과 같다 :
는class App extends React.Component {
constructor(props) {
super(props);
this.state= {
comments: AppStore.getAll();
};
}
componentWillMount() {
var length = this.state.comments.length;
var firstnumber = length - 4;
if(length == 0){
console.log("here comes");
this.props.router.push('/');
}
else{
console.log('work normally');
}
}
}
는 사람이 좀 도와 줄래? 감사.
허용 된 답변보다 나은 접근 방법입니까? – Doug
@Doug 개인적으로 그렇게 생각합니다.하지만 YMMV는 게시했습니다. :) – ivarni