{t("key")}
; //returns corresponding translated text from translation files + return{t("key")}
; //returns corresponding translated text from translation files } ``` @@ -37,7 +37,7 @@ import React from "react"; import { withTranslation } from "react-i18next"; function MyComponent({ t, i18n }) { - return{t("my translated text")}
; + return{t("my translated text")}
; } export default withTranslation()(MyComponent); @@ -56,13 +56,13 @@ import React from "react"; import { Trans, useTranslation } from "react-i18next"; function MyComponent() { - const { t } = useTranslation("myNamespace"); + const { t } = useTranslation("myNamespace"); - return ( -