1、语法
onClick={this.handleOk} 与onClick={this.handleOk()}
后面加括号表示直接调用。
错误提示:
Cannot update during an existing state transition (such as within `render` or another component's constructor).
Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern
but can be moved to `componentWillMount`.
2、全局this
this.handleOk = this.handleOk.bind(this);
解决组件之间调用报处this.setState is not a function
3、路由跳转
import { browserHistory} from 'react-router';
browserHistory.push("/FieldList?typeid="+record.id);
onClick={this.handleOk} 与onClick={this.handleOk()}
后面加括号表示直接调用。
错误提示:
Cannot update during an existing state transition (such as within `render` or another component's constructor).
Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern
but can be moved to `componentWillMount`.
2、全局this
this.handleOk = this.handleOk.bind(this);
解决组件之间调用报处this.setState is not a function
3、路由跳转
import { browserHistory} from 'react-router';
browserHistory.push("/FieldList?typeid="+record.id);