react报错this.setState is not a function
改变react组件的state值,通过setSate来修改
实际使用中发现报错
原因;
export class VenProductListTabs extends React.Component<any> { constructor(props) { super(props); this.state = {refreshFlag: true}; this.change=this.change.bind(this)//将this传入 否则会找不到this 从而报错 } change(){ let refreshFlag=this.state.refreshFlag; this.setState({ refreshFlag: !this.state.refreshFlag }); } render() { return ( <Tabs> </Tabs> ); } }