How to use the react-i18next.loadNamespaces function in react-i18next

To help you get started, we’ve selected a few react-i18next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / react-i18next_v7.x.x / flow_v0.62.x-0.63.x / test_react-i18next_v7.x.x.js View on Github external
it("raises error when called with incorrect arguments", () => {
      // $ExpectError - too few arguments
      loadNamespaces();
      // $ExpectError - wrong type
      loadNamespaces("");
      // $ExpectError - wrong components type
      loadNamespaces({ components: [{}], i18n });
    });
  });
github flow-typed / flow-typed / definitions / npm / react-i18next_v6.x.x / test_react-i18next_v6.x.x.js View on Github external
} />;

// $ExpectError - missing children prop
;
// $ExpectError - missing i18n prop
} />;

// passing
loadNamespaces({ components: [], i18n });
loadNamespaces({ components: [() =&gt; <div>], i18n });

// $ExpectError - too few arguments
loadNamespaces();
// $ExpectError - wrong type
loadNamespaces("");
// $ExpectError - wrong component type
loadNamespaces({ components: [{}], i18n });

type OwnProps = { s: string };
type Props = OwnProps &amp; { t: TFunction };

const Comp = ({ s, t }: Props) =&gt; <div>;

class ClassComp extends React.Component {
  render() {
    const { s, t } = this.props;
    return <div>;
  }
}

// $ExpectError - wrong argument type</div></div></div>
github flow-typed / flow-typed / definitions / npm / react-i18next_v7.x.x / flow_v0.53.x-0.61.x / test_react-i18next_v7.x.x.js View on Github external
} /&gt;;

// $ExpectError - missing children prop
;
// $ExpectError - missing i18n prop
} /&gt;;

// passing
loadNamespaces({ components: [], i18n });
loadNamespaces({ components: [() =&gt; <div>], i18n });

// $ExpectError - too few arguments
loadNamespaces();
// $ExpectError - wrong type
loadNamespaces("");
// $ExpectError - wrong component type
loadNamespaces({ components: [{}], i18n });

type OwnProps = { s: string };
type Props = OwnProps &amp; { t: TFunction };

const Comp = ({ s, t }: Props) =&gt; <div>;

class ClassComp extends React.Component {
  render() {
    const { s, t } = this.props;
    return <div>;
  }
}

// $ExpectError - wrong argument type</div></div></div>
github DefinitelyTyped / DefinitelyTyped / types / react-i18next / v4 / react-i18next-tests.tsx View on Github external
render() {
    return (
      <div>
        <main>
          
        </main>
      </div>
    );
  }
}


  
;

loadNamespaces({ components: [App], i18n }).then(() =&gt; { }).catch(error =&gt; { });

;
;

  
;

type Key = "view" | "nav";

class GenericsTest extends React.Component {
  render() { return null; }
}

translate(['view', 'nav'])(GenericsTest);

class GenericsTest2 extends React.Component {