Skip to content

Commit

Permalink
fix ts examples
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jun 15, 2023
1 parent 217c5a8 commit 82fe572
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
14 changes: 8 additions & 6 deletions example/react-typescript/simple-multi-namespaces/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import './i18n/config';
import { useTranslation } from 'react-i18next';
import Comp1 from './components/Comp1';
import Comp2 from './components/Comp2';
import Comp3 from './components/Comp3';

function App() {
const {t} = useTranslation();

return (
<div className="App">
<p>{t('title')}</p>
<p>{t('description.part1')}</p>
<p>{t('description.part2')}</p>
<Comp1 />
<hr />
<Comp2 />
<hr />
<Comp3 />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';

function Comp2() {
const {t} = useTranslation(['ns1', 'ns2']);
const { t } = useTranslation(['ns1', 'ns2']);

return (
<div className="App">
<p>{t('ns1:description.part1')}</p>
<p>{t('ns2:description.part2')}</p>
<p>{t('description.part1', { ns: 'ns1' })}</p>
<p>{t('description.part2', { ns: 'ns2' })}</p>
</div>
);
}

export default Comp2;
export default Comp2;

0 comments on commit 82fe572

Please sign in to comment.