does reactI18nextOptions have default value?

16 Views Asked by At

TransWithoutContext.js from the source code of react-i18next

const reactI18nextOptions = { ...getDefaults(), ...(i18n.options && i18n.options.react) };
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
return useAsParent? createElement(useAsParent, additionalProps, content) : content;

My code

i18n.use(initReactI18next).init({
  resources: {
    [SupportLanguage.zhCN]: ch,
    [SupportLanguage.enUS]: en,
  },
  lng: LocalStorageWrapper.getOrDefault(
    LanguageStorageKey,
    SupportLanguage.zhCN
  ),
  fallbackLng: SupportLanguage.zhCN,
  interpolation: {
    escapeValue: false,
  },
});

When initializing the i18n instance, I do not set the react option. But the doc said that these options have default values if we do not set them. My question is : value of i18n.options.react is undefined or default in this case.

0

There are 0 best solutions below