-
Notifications
You must be signed in to change notification settings - Fork 71
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
The onChange
prop is not updated on every render.
#11
Comments
Hi @nicu-chiciuc, thanks for letting me know about this problem. You're right, the I've implemented the project's examples with hooks as well (see this file). Maybe it wasn't working for you because of this bug. Could you please let me know if you're still encountering problems with the latest release? |
Sorry for the very late reply. I've solved the issue by sending a function which calls another function that is updated using a ref. The problem with your hooks example is that the passed anonymous function passed to
The setFontFamilyCurrent function will be the one that is updated on each rerender. |
Thanks for your response. I've just made the |
Thank you @samuelmeuli |
The onChange prop is passed to the
font-picker
constructor during the initialization of the component. This means that changing theonChange
prop will not change the callback that was passed initially.Since I'm using hooks for my component this means that no matter what changes, the
FontPicker
will always call the initially passed callback.The text was updated successfully, but these errors were encountered: