-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. #15742
Comments
I could not reproduce it. It ran fine for me. I ran <html>
<head>
<title>Document</title>
</head>
<body>
<div class="application"></div>
<script src="./bundle.js"></script>
</body>
</html> And it rendered If you haven't, you could also try to solve it using by following this document. |
Here is my webpack output. You can just put it in a folder somewhere and have a web server point at it (MAMP for instance). If you open the url it will show the error. Sorry for forgetting the instructions. I do No need to create the As you can see, I am not the only one that managed to have this issue with my code: |
Can you share your package.json? |
My package.json and all other files are in the github repo I put in my first post. |
So, what causes this? |
|
@ir-fuel , I was able to resolve a similar issue in my code base by, deleting my node_modules folder, cleaning the npm cache (npm cache clean -f) and removing my package-lock.json file. Then performing an npm install. Hope that helps you also. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I am getting this error:
Here is an example project that shows the problem:
https://github.com/ir-fuel/material-test
What is the expected behavior?
It should not give an error
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16.8.6
Chrome Version 74.0.3729.157 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: