Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

fix: effect callback called on each render when dimensions have not changed #33

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

Conversation

ninjz
Copy link

@ninjz ninjz commented May 15, 2022

The hook useDimensionsListener returns a new object. This results in the hook useDimensionsChange to always call the effect callback on each render since useDimensionsListener() returns a new object each time.

This PR fixes this by using the screen and window properties explicitly as the dependencies for useEffect.

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

Successfully merging this pull request may close these issues.

None yet

1 participant