-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.tsx
34 lines (30 loc) · 984 Bytes
/
app.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {CssBaseline} from '@material-ui/core'
import {useEffect, useState} from 'react'
import {useRoutes} from 'react-router-dom'
import {H1, MyButton} from 'atoms'
import {routeConfig} from './route-config'
import {t} from '@lingui/macro'
import {I18nProvider} from '@lingui/react'
import {i18n} from '@lingui/core'
import {dynamicActivate} from './i18n'
import {NavMenu} from './nav-menu'
export const App = () => {
const [count, setCount] = useState(0)
const [locale, setLocale] = useState<Locale>('en')
const pageElement = useRoutes(routeConfig)
useEffect(() => {
dynamicActivate(locale)
}, [locale])
const onClick = () => setCount((x) => x - 5)
return (
<I18nProvider i18n={i18n}>
<CssBaseline />
<NavMenu locale={locale} setLocale={setLocale} />
{pageElement}
<H1>Hello world! {count}</H1>
<MyButton onClick={onClick} variant="outlined" color="primary">
{t`increment`}
</MyButton>
</I18nProvider>
)
}