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

useRefMounted Implementation #106

Closed
nathanforce opened this issue Feb 12, 2019 · 0 comments
Closed

useRefMounted Implementation #106

nathanforce opened this issue Feb 12, 2019 · 0 comments

Comments

@nathanforce
Copy link

I implemented a similar hook recently and learned some stuff along the way.

https://github.com/palmerhq/react-register-nodes/blob/abfb4bd84b960eaae87ad0fa7bde7d42470fd71c/src/index.tsx#L101-L116

Notably, useRefMounted needs to use callback refs to be sure that the ref is updated whenever the component is (deeply) mounted and unmounted.

Nice work!

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

2 participants