In the pages directory, the next/head React component is used to manage <head> HTML elements such as title and meta . In the app directory, next/head is replaced with a new head.js special file.
Before:
pages/index.tsx
import Head from 'next/head'
export default function Page() {
return (
<>
<Head>
<title>My page title</title>
</Head>
</>
)
}
After:
app/head.tsx
export default function Head() {
return (
<>
<title>My Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</>
)
}
'Program > React' 카테고리의 다른 글
[next.js] version 13, head.js (1) | 2023.01.06 |
---|---|
[next.js]An error occurred in the Server Components render. (0) | 2023.01.02 |
react-intersection-observer for loading more data(스크롤 데이터 로딩) (0) | 2022.12.22 |
yarn create next-app --typescript , antd (0) | 2022.07.07 |
Typescript + Router (0) | 2022.07.05 |
댓글