✏️ Next.js
[에러 해결] Title element received an array with more than 1 element as children.
category
✏️ Next.js
date
thumbnail
slug
next-js-error-titld-element-received-an-array-with-more-than-1-element-as-children
author
status
Public
tags
⚠️ error
summary
type
Post
<title> 태그가 하나의 텍스트 노드만 받을 수 있기 때문에 발생하는 에러이다.
에러 발생 코드
import Head from 'next/head';
export default function Seo({ title }) {
return (
<Head>
<title>{title} | Next Movie App</title>
</Head>
);
}
수정 코드
import Head from 'next/head';
export default function Seo({ title }) {
return (
<Head>
<title>{`${title}`} | Next Movie App</title>
</Head>
);
}
⇒ 템플릿 문자열로 감싸서 텍스트로 만들어 사용한다.