一直报这个错,地图加载的周期

export default class A extends React.Component {
    constructor(props) {
        super(props);
        this.scroll1 = this.scroll1.bind(this)
    }
    componentDidMount() {
  storage.removeCallbacks('HomeView', this.reloadData.bind(this))
        websocket.removeCallbacks('HomeView', null, this.onWsMessage.bind(this), null)
    }
    
    componentWillUnmount(){
  storage.addCallbacks('HomeView', this.reloadData.bind(this))
        websocket.addCallbacks('HomeView', null, this.onWsMessage.bind(this), null)
    }

    render() {
    };
}
 
代码大概这个样子,不知道哪里问题,解决再加。。。。
 
 
加入了以下代码,当页面互相切时不报错了,但是点击退出,再登录还是会报。。。
 
componentWillUnmount(){
        //重写组件的setState方法,直接返回空
        this.setState = (state,callback)=>{
          return;
        };  
    }
posted on 2017-12-15 10:44  安,小王子  阅读(434)  评论(0编辑  收藏  举报