Commit 98568046 authored by Patrick Smith's avatar Patrick Smith Committed by 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.
parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment