The AppState component in react native is used to notify the user whether the app is in background or foreground and returns a string. } 4. Creating componentWillUnmount() inbuilt method. Now we would call the AppState.removeEventListener() function here.