3
我正在使用reactjs並在我的web項目中反應路由器,並且出現錯誤,下面是代碼。反應路由器支持未定義
App.js
import React from 'react';
import {Router, Route, Link, browserHistory} from 'react-router'
import NewuserInfo from './NewUserInfomationComponent'
class AppComponent extends React.Component {
render() {
return (
<Router history={browserHistory}>
<Route path="/new/user/:pid" component={NewuserInfo}></Route>
</Router>
);
}
}
NewUserInfomationComponent.js
class NewUserInfomationComponent extends React.Component {
constructor(){
super(props)
this.state = {
ddiabetes: moment(),
pid: this.props.params.pid,
pmh : {},
pmh_con: '',
pmh_date: '',
pmh_mng: ''
}
}
在下面的代碼運行,我得到一個錯誤時,
Uncaught ReferenceError: props is not defined
哪有我解決這個問題?謝謝