react-navigation.github.io icon indicating copy to clipboard operation
react-navigation.github.io copied to clipboard

Add unsubscribe() to preventing-going-back example

Open kulak91 opened this issue 2 years ago • 1 comments

Hi there! 👋 I've added the unsubscribe() method to the "preventing-going-back" example. This addition ensures that we clean up the event listener when the component unmounts, preventing potential memory leaks and bugs.

The unsubscribe() method is called when the component is unmounted, which removes the listener set up for the beforeRemove event. This is important for maintaining a clean and efficient navigation flow by avoiding unnecessary event listeners stacking after the component is no longer in use.

image

Feel free to review the changes and let me know if there are any questions or feedback. Thanks! 😊

kulak91 avatar Aug 11 '23 09:08 kulak91

Deploy Preview for react-navigation-docs ready!

Name Link
Latest commit 7839cff38bc718b08762b3b65bb067adf01e6ddf
Latest deploy log https://app.netlify.com/sites/react-navigation-docs/deploys/64d5fdea640c7a0008d9cd90
Deploy Preview https://deploy-preview-1269--react-navigation-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Aug 11 '23 09:08 netlify[bot]