1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

[examples] Update react jss example (#6198)

This updates the react-jss example to work with the v10 alpha
This commit is contained in:
Henri 2019-02-04 11:51:38 +01:00 committed by Tim Neutkens
parent 815f2e9138
commit 98cf0a8311
3 changed files with 7 additions and 6 deletions

View file

@ -7,10 +7,10 @@
"start": "next start"
},
"dependencies": {
"next": "latest",
"next": "canary",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-jss": "8.6.1"
"react-jss": "10.0.0-alpha.9"
},
"license": "ISC"
}

View file

@ -1,15 +1,16 @@
import React from 'react'
import Document, { Head, Main, NextScript } from 'next/document'
import { SheetsRegistry, JssProvider } from 'react-jss'
import { SheetsRegistry, JssProvider, createGenerateId } from 'react-jss'
export default class JssDocument extends Document {
static async getInitialProps (ctx) {
const registry = new SheetsRegistry()
const generateId = createGenerateId()
const originalRenderPage = ctx.renderPage
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: App => props => (
<JssProvider registry={registry}>
<JssProvider registry={registry} generateId={generateId}>
<App {...props} />
</JssProvider>
)

View file

@ -1,5 +1,5 @@
import React from 'react'
import injectSheet from 'react-jss'
import withStyles from 'react-jss'
const styles = {
container: {
@ -23,4 +23,4 @@ function Index (props) {
)
}
export default injectSheet(styles)(Index)
export default withStyles(styles)(Index)