react-native-branch
react-native-branch copied to clipboard
How do I unsubscribe from the branch subscription method
I need to cleanup my branch subscription event if my component unmounts.
I can't find the unsubscribe method on branch
like branch.unsubscribe()
Can anyone help me out with this.
Here's the sample code
import branch from 'react-native-branch';
function App(){
useEffect(() => {
branch.subscribe(({ error, params }) => {
// code
});
return (() => {
// Cleanup
})
}, [])
}