I want to change the state data from the API when the application is killed by the user.
I have tried using the componentWillUnmount to change data when the application closes, I also use the AppState
_handleAppStateChange = (nextAppState) => {
if (
this.state.appState.match(/inactive|background/) &&
nextAppState === 'active'
) {
console.log('App has come to the foreground!')
}
this.setState({ appState: nextAppState })
}
I want that when the application is killed by the user, it can change the state automatically.