Today I Learned

Always remember to remove listeners with MobileApp

It’s good practice to remember about EventListeners, especially in mobile apps. Just a few additional lines give you several times less probability to crash the app.

const onLogOut = () => {
  if (Platform.OS === 'ios') {
    PushNotificationIOS.removeEventListener('notification')
    PushNotificationIOS.removeEventListener('register')
  } else {
    androidNotificationListeners.map(listener => listener.remove())
  }
}