NamespacesConsumer (v9)
Last updated
Last updated
The NamespacesConsumer is a so called render prop. The component passes the to child function and triggers loading the translation files defined. Further it asserts the component gets rerendered on language change or on changes to the translations themselves.
options
type (default)
description
wait
boolean (false)
In most cases you like to set this to true. If not handling not ready by evaluating ready.
nsMode
string ('default')
default: namespaces will be loaded and the first will be set as default fallback: namespaces will be used as fallbacks used in order provided
bindI18n
string ('languageChanged loaded')
which events trigger a rerender, can be set to false or string of events
bindStore
string ('added removed')
which events on store trigger a rerender, can be set to false or string of events
omitBoundRerenders
boolean (true)
Does not trigger rerenders while state not ready - avoiding unneeded renders on init
i18n
object (undefined)
initialI18nStore
object (undefined)
initialLanguage
string (undefined)
assert all provided namespaces are loaded before rendering the component (can be set too).
Note that rendering will not be blocked again when dynamically updating the ns
prop after initial mount.
pass i18next via options (useful for )
pass in initial translations (useful for )
pass in initial language (useful for )