react-i18next documentation
🏠 i18next🌐 localization as a service🎓 i18next crash course💾 GitHub Repository
  • Introduction
  • Getting started
  • Guides
    • Drawbacks of other i18n solutions
    • Quick start
    • Multiple Translation Files
    • Extracting translations
  • latest
    • Step by step guide
    • i18next instance
    • useTranslation (hook)
    • withTranslation (HOC)
    • Translation (render prop)
    • Trans Component
    • I18nextProvider
    • SSR (additional components)
    • Migrating v9 to v10
    • TypeScript
  • Misc
    • Using with ICU format
    • Using with fluent format
    • Testing
  • legacy v9
    • Step by step guide (v9)
    • Overview (v9)
    • i18next instance (v9)
    • I18nextProvider (v9)
    • withI18n (v9)
    • withNamespaces (v9)
    • NamespacesConsumer (v9)
    • Trans Component (v9)
    • Interpolate (v9)
    • SSR (v9)
  • 🌐localization as a service
  • 🎓i18next crash course
  • 💾GitHub Repository
Powered by GitBook
On this page
  1. legacy v9

I18nextProvider (v9)

Last updated 6 years ago

The provider is responsible to pass the i18next instance passed in by props down to all the hocs or 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')
);

For the i18n instance have a look at the .

As an alternative you can use the in the i18n instance.

The I18nextProvider props:

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)

pass in initial translations (useful for )

pass in initial language (useful for )

withNamespaces
NamespacesConsumer
i18next instance page
reactI18nextModule
serverside rendering
serverside rendering