Reactjs Can';t在未安装的组件上执行React状态更新。内存泄漏

Reactjs Can';t在未安装的组件上执行React状态更新。内存泄漏,reactjs,react-native,reactjs-flux,react-native-router-flux,Reactjs,React Native,Reactjs Flux,React Native Router Flux,我正在使用react本机路由器流量,并将地址传递给前一个组件。值传递但我得到警告无法对已卸载的组件执行React状态更新以修复、取消componentWillUnmount方法中的所有订阅和异步任务 class ChangeAddress extends Component { constructor(props) { super(props); this.state = { text:'' }; this.handleChange = thi

我正在使用react本机路由器流量,并将地址传递给前一个组件。值传递但我得到警告无法对已卸载的组件执行React状态更新以修复、取消componentWillUnmount方法中的所有订阅和异步任务


class ChangeAddress extends Component {

  constructor(props) {
    super(props);
    this.state = {
      text:''
    };
    this.handleChange = this.handleChange.bind(this);
  }

    onPressNext =() => {
       Actions.replace('Navigate', {text:this.state.text});
    }

    handleChange(text) {
      this.setState({ text: text });
    }

  render() {
       return(
        <View>
            <TextInput
                placeholder="Enter Address"         
                onChangeText={this.handleChange } 
            />
            <Button title =" Save Address" onPress={this.onPressNext}  />
        </View>
        );
  }
}
export default ChangeAddress;```

类ChangeAddress扩展组件{
建造师(道具){
超级(道具);
此.state={
文本:“”
};
this.handleChange=this.handleChange.bind(this);
}
onPressNext=()=>{
Actions.replace('Navigate',{text:this.state.text});
}
手册更改(文本){
this.setState({text:text});
}
render(){
返回(
);
}
}
导出默认更改地址```
尝试以下示例代码:-

看看我在哪里添加了_ismount,并在代码中遵循相同的步骤

class Page extends Component {
 _isMounted = false;

 state = {
   isLoading: true
 }

 componentDidMount() {
  this._isMounted = true;

  callAPI_or_DB(...).then(result => {
    if (this._isMounted) {
     this.setState({isLoading: false})
   }
  });
}

componentWillUnmount() {
this._isMounted = false;
}

render() {
  return (
    <div>Whatever</div>
    );
  }
}

export default Page;
类页扩展组件{
_isMounted=错误;
状态={
孤岛加载:正确
}
componentDidMount(){
这个。_isMounted=true;
调用API_或_DB(…)。然后(结果=>{
如果(此项已安装){
this.setState({isLoading:false})
}
});
}
组件将卸载(){
这个。_isMounted=false;
}
render(){
返回(
无论什么
);
}
}
导出默认页面;

我需要在这里写什么
componentDidMount(){this.\isMounted=true;callAPI\u或\u DB(…)。然后(result=>{if(this.\isMounted){this.setState({isLoading:false}}}}}}
我的代码中没有使用componentDidMount