I am trying to use OneSignal for notifications and they initialise it like this....
OneSignal.push(function () {
OneSignal.init({
appId: self.props.data.pushAppId,
notifyButton: {
enable: true,
},
allowLocalhostAsSecureOrigin: true,
})
})
Which works great cause I only want it shown in certain pages so it lives in componentDidMount. When I navigate away from that page it doesn't remove the bell notification so it continues to exist on pages that I do not initialise it on.
How can I (in componentWillUnmount i'm guessing) remove the instance of it gets destroyed on page change.
It will remove on hard refresh of other pages but router changes it doesn't get removed.
Thanks