mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
styled-components example: use a fragment for styles initial prop (#6252)
`initialProps.styles` is a React node, but not guaranteed to be an array, so we can use a fragment to concatenate additional styles. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32932#issuecomment-462372319
This commit is contained in:
parent
734513b9be
commit
4dd6094639
|
@ -15,7 +15,7 @@ export default class MyDocument extends Document {
|
|||
const initialProps = await Document.getInitialProps(ctx)
|
||||
return {
|
||||
...initialProps,
|
||||
styles: [...initialProps.styles, ...sheet.getStyleElement()]
|
||||
styles: <>{initialProps.styles}{sheet.getStyleElement()}</>
|
||||
}
|
||||
} finally {
|
||||
sheet.seal()
|
||||
|
|
Loading…
Reference in a new issue