-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
Invalid hook call with next-i18nnext #611
Comments
Please provide a full reproducible example. Unfortunately the snippets above are not enough. |
I did not get the error in a small example, though, the translation function does not work here - https://codesandbox.io/s/nextjs-djhgs In my example, there is also such a stacktrace.
|
@isaachinman Here is the link to the project where this error is replicated. |
I do not understand the setup of that linked repository, but it certainly is not a minimal reproducible example. Can you try to isolate the issue here? |
@eakarpov next-i18next HOC @isaachinman I think what he means is that there is no way to make use of the next-i18next withTranslation HOC on a functional component. But I am unsure of this since I have not tested it. Issue can be closed until there is a replicateable example of the error |
@HarisSpahijaPon hmm, that is a first constructive answer, thank you. I will try whether it works in class. I supposed there was no difference if the component is functional or not. |
@eakarpov To start a constructive discussion we need a minimal reproducible example. Support for HOC on functional components on The |
Functional components are fully supported by this package. |
@eakarpov Any update? |
This is likely an upstream bug vercel/next.js#9022 |
If anyone can reproduce this after upgrading to the latest NextJs version, please let me know and I'll reopen. |
Describe the bug
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Occurs in next-i18next version
3.0.1
Steps to reproduce
Without withTranslation wrapper everything is ok
As soon as we add withTranslation wrapper, application crashes with React error above
Expected behaviour
Render without problems
OS (please complete the following information)
The text was updated successfully, but these errors were encountered: