Skip to content

Commit

Permalink
[examples] Update react jss example (#6198)
Browse files Browse the repository at this point in the history
This updates the react-jss example to work with the v10 alpha
  • Loading branch information
Henri authored and timneutkens committed Feb 4, 2019
1 parent 815f2e9 commit 98cf0a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/with-react-jss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
5 changes: 3 additions & 2 deletions examples/with-react-jss/pages/_document.js
Original file line number Diff line number Diff line change
@@ -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>
)
Expand Down
4 changes: 2 additions & 2 deletions examples/with-react-jss/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import injectSheet from 'react-jss'
import withStyles from 'react-jss'

const styles = {
container: {
Expand All @@ -23,4 +23,4 @@ function Index (props) {
)
}

export default injectSheet(styles)(Index)
export default withStyles(styles)(Index)

0 comments on commit 98cf0a8

Please sign in to comment.