-
Notifications
You must be signed in to change notification settings - Fork 126
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
Warnings about refs when using functional components #117
Comments
Yeah, it should be safe to use. withFormsy assigns a functional ref to the wrapped element which is equal to the innerRef prop you pass to it or a noop function if you don't pass anything. We should definitely remove this default noop function, especially since the truthyness of the innerRef prop is checked before it is passed on to the wrapped component. If you want to get rid of the warnings, just set the innerRef prop to null or false when using your component. |
@MilosRasic damn that was fast. Thanks, it works. |
I'm glad we have a work-around, but is this something we can fix in Formsy? Is there a way to check before passing down ref? |
@rkuykendall do we want a PR to fix this? It seems to be easily achievable just removing the default noop function form the HOC |
@almarto Yeah a PR would be appreciated. I don't think I understand the issue but it sounds like a simple fix. |
I made a stateless functional component and exported it with withFormsy(Component).
It works, but React prints warnings in the console:
"Stateless function components cannot be given refs. Attempts to access this ref will fail. Check the render method of Formsy(Component)"
Is there anything to do about this? I am not using refs in my component. It's me that doing something wrong or I can ignore it?
The text was updated successfully, but these errors were encountered: