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

[hooks] Hooks don't return stable functions #22

Closed
heyitsarpit opened this issue Dec 25, 2021 · 1 comment
Closed

[hooks] Hooks don't return stable functions #22

heyitsarpit opened this issue Dec 25, 2021 · 1 comment

Comments

@heyitsarpit
Copy link
Owner

Hooks don't currently return stable functions, i.e. the function is recreated on each render and cannot be properly used by user code inside an effect.

Solution - wrap all internal function with useCallback.

heyitsarpit added a commit that referenced this issue Dec 25, 2021
…ally

issue: #22

hooks changed:
- useClickOutside
- useKeyStroke
- useLocalStorage
- useMediaStream
- useScreenShare
- useSessionStorage
- useStateHistory
- useToggle
- useUnMount
heyitsarpit added a commit that referenced this issue Dec 25, 2021
issues: #22

hooks affected:
- useLocalsStorage
- useMediaStream
- useSessionStorage
@heyitsarpit
Copy link
Owner Author

fixed in commit 55f4c4d and 5899ed4

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

No branches or pull requests

1 participant