Skip to content

useAppState: useEffect should declare none deps to avoid trigger each render #14

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

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

nihaux
Copy link

@nihaux nihaux commented Mar 14, 2019

At the moment useAppState does not declare its dependencies (none) in useEffect hook.
Direct consequence is that useEffect is called for each render of the component that useAppState.
Still works but triggers unnecessary add/remove listeners.
Fix: declare [] (none) as useEffect deps.

@dabit3 dabit3 merged commit 9c229ff into react-native-community:master Aug 20, 2019
@pvinis
Copy link
Member

pvinis commented Feb 21, 2020

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants