Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unsubscribe() to preventing-going-back example #1269

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kulak91
Copy link

@kulak91 kulak91 commented Aug 11, 2023

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! 😊

@netlify
Copy link

netlify bot commented Aug 11, 2023

Deploy Preview for react-navigation-docs ready!

Name Link
🔨 Latest commit 7839cff
🔍 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant