Search code examples
react-hooksreact-i18next

react-i18next v10 without hooks


I have been trying to implement react-i18next (10.9.0) by using the code from below link:

https://codesandbox.io/s/l23no88qmz?from-embed

But I got the error:

Attempted import error: 'translate' is not exported from 'react-i18next'.

From [ https://github.com/i18next/react-i18next/issues/810 ], I came to know that 'translate' was used in v8, and v10 uses hooks.

I wanted to know if I could use react-i18next (10.9.0) without hooks? If yes, what should I use instead of 'translate'?


Solution

  • react-i18next v10 has been specifically refactored to work with hooks, so you'll need to either adapt your code to support hooks, either use the legacy v9 version.