1
0
Fork 0
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:
Jayden Seric 2019-01-10 22:53:43 +11:00 committed by Tim Neutkens
parent eb24e6ffc6
commit 49fea51f34

View file

@ -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
})
}