Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
98cf0a83
Commit
98cf0a83
authored
Feb 04, 2019
by
Henri
Committed by
Tim Neutkens
Feb 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[examples] Update react jss example (#6198)
This updates the react-jss example to work with the v10 alpha
parent
815f2e91
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
package.json
examples/with-react-jss/package.json
+2
-2
_document.js
examples/with-react-jss/pages/_document.js
+3
-2
index.js
examples/with-react-jss/pages/index.js
+2
-2
No files found.
examples/with-react-jss/package.json
View file @
98cf0a83
...
...
@@ -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"
}
examples/with-react-jss/pages/_document.js
View file @
98cf0a83
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
>
)
...
...
examples/with-react-jss/pages/index.js
View file @
98cf0a83
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment