-
-
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
App defined as stateless function gets a warning #645
Comments
Duplicate of #615. From the exact link you provided:
|
Sorry for the dupe, PRed a clearer explanation in the README (#646) It's easy to fall in this trap if you defined the custom app before adding i18n. The component version that extends App is uncommon (multiple level of inheritance is avoided in functional development, you barely see that in React code in the first place) and adds Thanks for the detailed explanation in the other issue! |
It's not "uncommon", it's just "fallen out of fashion" - it used to be the recommended way via the NextJs docs. |
Describe the bug
App defined as stateless function won't work as expected (
getInitialProps
not detected, triggering a warning about namespaceRequired not being defined).Occurs in next-i18next version
4.2.0
Example:
Steps to reproduce
Comment or uncomment one of the 2 versions.
Expected behaviour
If using a class component is mandatory, it should be documented.
In Next doc, the stateless syntax is preferred: https://nextjs.org/docs/advanced-features/custom-app
The text was updated successfully, but these errors were encountered: