-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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
Confusing error when passing non-function to useMemo #16589
Comments
Huh. This is usually caught by flow/typescript, but I can see why it might be confusing without a type system. Do you believe this is a common problem? If so, maybe a DEV warning would be good. |
@threepointone , If you resolve to have a dev warning for this, I could work on that |
@aweary I have an incoming PR for this |
Why is this still open? |
|
No one ever approved my PR, so I closed it |
Example.
When passing something like an object to
useMemo
the error isn't very helpful.Most developers wont know what
nextCreate
is, and passing an object touseMemo
doesn't seem obviously wrong at first. We could add atypeof
check that throws a better error, but maybe that's too much overhead? At the very least we could add a DEV warning with more helpful guidance.The text was updated successfully, but these errors were encountered: