mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix Head.propTypes (#6020)
This PR fixes the buggy `Head.propTypes` here: https://github.com/zeit/next.js/blob/v8.0.0-canary.3/packages/next-server/lib/head.js#L107 Currently, `Head.propTypes` allows one child node like this: ```jsx import Head from 'next/head' // … <Head> <title>Title</title> </Head> ``` But more than one child node mistakenly causes a prop type error like this: ```jsx <Head> <title>Title</title> <meta name="description" content="Description." /> </Head> ``` ``` Warning: Failed prop type: Invalid prop `children` supplied to `Head`. ```
This commit is contained in:
parent
eb24e6ffc6
commit
49fea51f34
|
@ -104,7 +104,7 @@ 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
|
||||
children: PropTypes.node.isRequired
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue