MCPcopy Create free account
hub / github.com/i18next/react-i18next / Page

Function Page

example/devserver-save-missing/src/App.jsx:25–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24// page uses the hook
25function Page() {
26 const { t, i18n } = useTranslation();
27
28 const changeLanguage = (lng) => {
29 i18n.changeLanguage(lng);
30 };
31
32 return (
33 <div className="App">
34 <div className="App-header">
35 <img src={logo} className="App-logo" alt="logo" />
36 <Welcome />
37 <button type="button" onClick={() => changeLanguage('de')}>
38 de
39 </button>
40 <button type="button" onClick={() => changeLanguage('en')}>
41 en
42 </button>
43 </div>
44 <div className="App-intro">
45 <MyComponent />
46 </div>
47 <div>{t('description.part2')}</div>
48 <div>{t('description.part3', 'some new translations....')}</div>
49 </div>
50 );
51}
52
53// loading component for suspense fallback
54const Loader = () => (

Callers

nothing calls this directly

Calls 3

useTranslationFunction · 0.90
tFunction · 0.85
changeLanguageFunction · 0.70

Tested by

no test coverage detected