import React from 'react';
import { withNamespaces } from 'react-i18next';
function TranslatableView(props) {
const { t, tReady } = props;
// tReady is true if translations were loaded.
// Use wait option to not render before loaded
// or render placeholder yourself if not tReady=false
<h1>{t('keyFromDefault')}</h1>
<p>{t('anotherNamespace:key.from.another.namespace', { /* options t options */ })}</p>
export default withNamespaces([
], { /* additional options see below */ })(TranslatableView);
// or: short for only loading one namespace:
export default withNamespaces('defaultNamespace')(TranslatableView);
// or: short for using defaultNS defined in i18next
export default withNamespaces()(TranslatableView);
// or: using a function to return namespaces based on props
export default withNamespaces((props) => props.namespaces)(TranslatableView);