title: How to detect an application in the kill app on react native?
body: <p>I want to change the state data from the API when the application is killed by the user.</p>
  
  <p>I have tried using the componentWillUnmount to change data when the application closes, I also use the AppState</p>
  
  <pre><code>  _handleAppStateChange = (nextAppState) =&gt; {
      if (
        this.state.appState.match(/inactive|background/) &amp;&amp;
        nextAppState === 'active'
      ) {
        console.log('App has come to the foreground!')
      }
      this.setState({ appState: nextAppState })
    }
  
  
  </code></pre>
  
  <p>I want that when the application is killed by the user, it can change the state automatically.</p>