Skip to content

Conversation

@juzhiyuan
Copy link

use useRef instead of useState

use useRef instead of useState
@frzkn
Copy link
Owner

frzkn commented Jul 11, 2020

Hey @juzhiyuan thanks for your interest in the project!

Using useState instead of useRef was intentional, changes to ref do not cause a re-render therefore the hook will not rerun unless the state changes.

Try it in the example page to know more.

@juzhiyuan
Copy link
Author

🤔 Not sure, I test this library with useRef on Codesandbox, and it works.

@juzhiyuan
Copy link
Author

Could you please provide more info between ref and state when you are free?

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.

2 participants