react-native-branch icon indicating copy to clipboard operation
react-native-branch copied to clipboard

How do I unsubscribe from the branch subscription method

Open ameernormie opened this issue 5 years ago • 0 comments

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
        })
   }, [])

}

ameernormie avatar Nov 29 '19 05:11 ameernormie