React options
The options under react in init() decide when components render again and how Trans treats HTML.
javascript
i18n.use(initReactI18next).init({
// ...
react: {
useSuspense: false, // use the ready flag of useTranslation instead
bindI18n: 'languageChanged loaded', // also render again after a load
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p', 'em'],
},
});
bindI18n(default'languageChanged'): the instance events, separated by spaces, after whichuseTranslation,withTranslation,Translation,TransandIcuTransrender again;falsefor none.bindI18nStore(default''): the same for the events of the resource store, for example'added removed'.useSuspense(defaulttrue): components suspend while their translations load; withfalse,useTranslationreturns areadyflag instead.nsMode(default'default'): with'fallback',tlooks in every namespace the component names, in order, not only in the first.keyPrefix(no default): a prefix for the keys of everytfromuseTranslation, as a string or a selector function.defaultTransParent(no default): an elementTranswraps its content in, for example'div'.transEmptyNodeValue(default''): the default text of aTranswithout children and withoutdefaults.transSupportBasicHtmlNodes(defaulttrue): keeps simple HTML elements such as<br/>by their name in translations; see Trans.transKeepBasicHtmlNodesFor(default['br', 'strong', 'i', 'p']): the elements kept by their name.transWrapTextNodes(default''): wraps each text node ofTransin this element, for example'span'.transDefaultProps(no default): defaulttOptions,valuesandcomponentsfor everyTrans.hashTransKey(no default): a function that makes the key of aTranswithouti18nKeyfrom its text; without it, the text is the key.unescape(default: decodes basic HTML entities): the functionTransuses to decode HTML entities in its output.
The options belong to the instance they are set on; setDefaults() sets them for all instances.
All other options of init(): Configuration options.