-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
useImperativeHandle should warn when second arg isn't a function #14629
Comments
I believe the issue here is that // before (your sample code)
useImperativeHandle(ref, {
foo: () => console.log("Print foo from Test component")
});
// after
useImperativeHandle(ref, () => ({
foo: () => console.log("Print foo from Test component")
})); See: https://reactjs.org/docs/hooks-reference.html#useimperativehandle for more information about the API of the hook. Maybe the error thrown could be more clear? |
You're right, |
Ill take this issue on |
Sure |
i get TypeError: React.useImperativeMethods is not a function in 16.8.0-alpha.1 but when back to 16.7.0-alpha.2 not get this error |
@AhmedElywa The hook was renamed in this PR: #14565 Most likely between the 16.7 alpha and 16.8 alpha |
Yeah, it was renamed. |
yes it work good after rename it where i can get changes between alpha version ? |
Commit log. We don't write changelogs for alphas. |
@Aberman12 I'm taking this in #14647 since we want to get Hooks out sooner. |
alright np |
I've noticed a strange bug with the react redux
forwardRef
opt-in.If i use it with a connected class component, everything is ok:
If i use it with a connected functional component that use
forwardRef
withuseImperativeHandle
, i obtain a strange error:create is not a function
incommitHookEffectList
react-dom
method.I create a codepen to reproduce the issue: https://codesandbox.io/s/r7rpml460o
PS: Sorry for the cors error, but i don't find the way to add
react@next
as cdnThe text was updated successfully, but these errors were encountered: