Skip to content
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

Tweak invalid Hook warning and error #14747

Merged
merged 1 commit into from Feb 1, 2019

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Feb 1, 2019

  • Adds a link to https://reactjs.org/warnings/invalid-hook-call-warning.html for the invariant. (I guess it's not a warning.. but I also don't want to introduce a new URL naming scheme. We don't have separate pages for errors right now. We can move it later if it causes confusion but I'm not sure it would.)

  • Rewords the warning when we know more exactly what happened.

);
if (__DEV__) {
warning(
!isInHookUserCodeInDev,
'Hooks can only be called inside the body of a function component. ' +
'Do not call Hooks inside other Hooks. For more information, see ' +
'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice nice nice

@gaearon gaearon merged commit c21c41e into facebook:master Feb 1, 2019
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants