React community is increasingly moving towards enabling functionality via the hook pattern which provides increased readability and reusability between components and projects.
I wish this package would support using the useTranslation hook which exists in react-i18next since version 10, as the dependency of this project now would technically support it.
Currently my project uses the HOC approach, and the <Trans> component has also been considered, but I would much prefer using the hook.
I haven't really dug into the insides of this project as of yet but if there's something I could do to help regarding the development I would be happy to do so if I manage to arrange my calendars :)
That's an awesome idea, I'm waiting new features implemented by react-i18next.
I tried to access react-i18next instance directly from next-i18next without success.
Do you plan to integrate new features directly from next-i18next or create a way to access react-i18next directly from next-i18next ?
Please read from https://github.com/isaachinman/next-i18next/issues/164#issuecomment-501430656 onwards.
If it makes enough people happy, I suppose we _could_ just import and then export various react-i18next methods.
I can also confirm that the useTranslation works when imported directly from react-i18next, sorry that I missed the discussion before submitting this issue... I think it could even be added as an example in the README.md!
As a personal opinion though, I would prefer to have a single dependency for my i18n needs (next-i18next) instead of having to import both this and react-i18next, especially when the latter is already a dependency of your package. I feel like I would rather use next-i18next as a Next.js optimized wrapper for the complete react-i18next rather than a reimplementation of just some of the features, but I can understand if you have a different vision for this package 馃憤
Thanks, I'll try to import react-i18next directly. However I have the same opinion as Jonesus.
I've added useTranslation to our exported class. Will go out with v0.42.0. Hope this helps!
Thanks, that will be very useful!
Most helpful comment
I've added
useTranslationto our exported class. Will go out with v0.42.0. Hope this helps!