/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
examples/with-react-intl/components/Layout.tsx
37 строк
824 B
Steven
chore(examples): use default prettier for examples/templates (#60530)
12 янв 2024, 02:01
Не верифицирован
12 янв 2024, 02:01
4466ba4
Код
Авторство
О чём код?
import { ReactNode } from "react"; import { useIntl } from "react-intl"; import Head from "next/head"; import Nav from "./Nav"; interface LayoutProps { title?: string; description?: string; children: ReactNode; } export default function Layout({ title, description, children }: LayoutProps) { const intl = useIntl(); title ||= intl.formatMessage({ defaultMessage: "React Intl Next.js Example", description: "Default document title", }); description ||= intl.formatMessage({ defaultMessage: "This page is powered by Next.js", description: "Default document description", }); return ( <> <Head> <title>{title}</title> <meta name="description" content={description} /> </Head> <header> <Nav /> </header> {children} </> ); }