mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
a0aaa933de
Fixes #5038 The problem with `constructor` is that it doesn't have `context` yet when being called. It's also considered unsafe to add a side-effect on constructor except when server-rendering
25 lines
480 B
JavaScript
25 lines
480 B
JavaScript
import dynamic from 'next/dynamic'
|
|
import Head from 'next/head'
|
|
|
|
const Test = dynamic({
|
|
loader: async () => {
|
|
// component
|
|
return () => {
|
|
return <div className='dynamic-style'>
|
|
<Head>
|
|
<style dangerouslySetInnerHTML={{ __html: `
|
|
.dynamic-style {
|
|
background-color: green;
|
|
height: 200px;
|
|
}
|
|
`}} />
|
|
</Head>
|
|
test
|
|
</div>
|
|
}
|
|
},
|
|
ssr: false
|
|
})
|
|
|
|
export default Test
|