Commit 98cf0a83 authored by Henri's avatar Henri Committed by Tim Neutkens

[examples] Update react jss example (#6198)

This updates the react-jss example to work with the v10 alpha
parent 815f2e91
......@@ -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"
}
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>
)
......
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment