rsnext/examples/with-react-intl/components/Layout.tsx
Long Ho 5a478b4eef
feat: upgrade react-intl workflow in example (#16215)
Changes:
- Migrate to TypeScript. `react-intl` natively supports TypeScript now.
- Upgrade corresponding `formatjs` packages.
- Dynamically polyfill Intl API per locale since those polyfills are huge.
- Migrate to recommended workflow per https://formatjs.io/docs/getting-started/application-workflow
2020-08-27 22:59:33 +00:00

28 lines
576 B
TypeScript

import * as React from 'react';
import {useIntl} from 'react-intl';
import Head from 'next/head';
import Nav from './Nav';
export default function Layout({title, children}) {
const intl = useIntl();
return (
<div>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
{title ||
intl.formatMessage({
defaultMessage: 'React Intl Next.js Example',
})}
</title>
</Head>
<header>
<Nav />
</header>
{children}
</div>
);
}