mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix with-amp example (#3153)
React v16 supports invalid DOM attributes now. ReactInjection and DOMProperty throws an error. Reference: #3152
This commit is contained in:
parent
e5c46c2632
commit
8c60a2e35d
|
@ -1,16 +1,4 @@
|
|||
import Document, { Head } from 'next/document'
|
||||
import { DOMProperty } from 'react-dom/lib/ReactInjection'
|
||||
import { properties as DOMProperties } from 'react-dom/lib/DOMProperty'
|
||||
|
||||
// By default React limit the set of valid DOM elements and attributes
|
||||
// (https://github.com/facebook/react/issues/140) this config whitelist
|
||||
// Amp elements/attributes
|
||||
if (typeof DOMProperties.amp === 'undefined') {
|
||||
DOMProperty.injectDOMPropertyConfig({
|
||||
Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
|
||||
isCustomAttribute: attributeName => attributeName.startsWith('amp-')
|
||||
})
|
||||
}
|
||||
|
||||
export default class MyDocument extends Document {
|
||||
render () {
|
||||
|
|
Loading…
Reference in a new issue