提交 02551d3b 编写于 作者: K Kuba Juszczyk 提交者: Tim Neutkens

Disable <title/> warning when React Helmet is used (#7483)

上级 cc6eecd2
......@@ -207,7 +207,8 @@ export class Head extends Component<OriginProps> {
// show a warning if Head contains <title> (only in development)
if (process.env.NODE_ENV !== 'production') {
children = React.Children.map(children, (child: any) => {
if (child && child.type === 'title') {
const isReactHelmet = child && child.props && child.props['data-react-helmet']
if (child && child.type === 'title' && !isReactHelmet) {
console.warn(
"Warning: <title> should not be used in _document.js's <Head>. https://err.sh/next.js/no-document-title"
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册