react.i18next.com Is working fine inside my main Project but not in my npm package which i used inside my main Project
See original GitHub issueQuestion about react-i18next
Questions should be posted on StackOverflow I have two project
- One is main project
- Second one is my react npm package(repository) which i used inside my main project’s package.json file as below,
"dependencies": { "package-name": "git+https://oauth2:<Access-Token>@gitlab.com/<Project-name>/react-menu.git" }
So if i followed all the steps given over here : https://react.i18next.com/latest/using-with-hooks Then it is working fine in main project using both way using Hook and using HOC
But when i am trying to add same code inside my another repository as i mentioned above then it is throwing error like below https://reactjs.org/docs/error-decoder.html/?invariant=321
So i dont know what was wrong.
Can you guys help me with this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
React i18next fails to load translation after in build
I'm using the react build folder inside Django project. It works fine on localhost:3000 only which is crazy but once i try to...
Read more >Getting started - i18next documentation
Optimized to load i18next in webpack, rollup, ... or node.js. The correct entry points are already configured in the package.json so there should...
Read more >TypeScript - react-i18next documentation
If your project is relying on TypeScript 4.1+, and you want to enhance IDE Experience and prevent ... import all namespaces (for the...
Read more >Getting started - react-i18next documentation
react -i18next can be added to your project using npm: # npm ... The correct entry points are already configured in the package.json....
Read more >Step by step guide - react-i18next documentation
If you need to access the t function or the i18next instance from outside of a React component you can simply import your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When I try:
From within my component library, that i18n instance is different from the one in my main app that is importing my component library. The result is empty strings for all translations in my component library.
Where and how did you initialize your i18next instance? How are your two projects set up?
Update: I got it to work by doing the following:
And in my component library package.json, adding the following to peerDependencies:
That way, the main projects i18n instance was used instead of bundling a separate version of all i18next packages and creating a second instance.
I have two project one is main project second one is react menu repositry from which i get menu
Inside my main project i handle everything regarding translation and whatever translation text i need inside my second project i am passing it as props so i can access them inside my second project