I18nextProvider (v9)
The provider is responsible to pass the i18next instance passed in by props down to all the withNamespaces hocs or NamespacesConsumer render prop using react context api.
import React from 'react';
import ReactDOM from 'react-dom';
import { I18nextProvider } from 'react-i18next';
import App from './App'; // your entry page
import i18n from './i18n'; // initialized i18next instance
ReactDOM.render(
<I18nextProvider i18n={ i18n }>
<App />
</I18nextProvider>,
document.getElementById('app')
);
name | type (default) | description |
i18n | object (undefined) | pass i18next instance the provider will pass it down to translation components by context |
defaultNS | string (undefined) | optionally pass down a default namespace to your translate HOC, I18n render prop (without having to specify it there) |
initialI18nStore | object (undefined) | |
initialLanguage | string (undefined) |
Last modified 4yr ago