提交 98568046 编写于 作者: P Patrick Smith 提交者: Tim Neutkens

Add PropType validation for next/head children (#5504)

Give `Head` a more detailed error messages in dev mode by validating the children prop's PropTypes.
上级 2c343bae
......@@ -100,4 +100,12 @@ function unique () {
}
}
if (process.env.NODE_ENV === 'development') {
const exact = require('prop-types-exact')
Head.propTypes = exact({
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]).isRequired
})
}
export default sideEffect(reduceComponents, onStateChange, mapOnServer)(Head)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册