Search code examples
reactjsi18nextreact-i18next

How do I trigger a forced update with react-i18next?


I am loading some resource bundles asynchronously, and I want to refresh the entire app when it's loaded. How can I do this?

i18n.addResourceBundle(locale, ns, messages, true, true);

// app is not updated

Update: I can use the bindToStore: 'add' option, but since multiple bundles can be loaded, I'd like to prevent the refresh until after everything is loaded.

So, for now, calling i18n.changeLanguage(lang); and bindToStore seems to be the only options,


Solution

  • You can call i18n.changeLanguage(lang); it will trigger re-render of the app.