未验证 提交 b088881a 编写于 作者: L Lukas Polak 提交者: GitHub

update/with-react-jss (#15156)

Use hooks with jss
上级 cb96da13
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
}, },
"dependencies": { "dependencies": {
"next": "latest", "next": "latest",
"react": "^16.7.0", "react": "^16.13.1",
"react-dom": "^16.7.0", "react-dom": "^16.13.1",
"react-jss": "10.0.0-alpha.9" "react-jss": "^10.3.0"
}, },
"license": "ISC" "license": "ISC"
} }
import withStyles from 'react-jss' import { createUseStyles } from 'react-jss'
const styles = { const useStyles = createUseStyles({
container: { container: {
marginTop: 100, marginTop: 100,
textAlign: 'center', textAlign: 'center',
...@@ -10,16 +10,18 @@ const styles = { ...@@ -10,16 +10,18 @@ const styles = {
fontSize: 24, fontSize: 24,
lineHeight: 1.25, lineHeight: 1.25,
}, },
} })
function Index() {
const classes = useStyles()
function Index(props) {
return ( return (
<div className={props.classes.container}> <div className={classes.container}>
<h1 className={props.classes.header}> <h1 className={classes.header}>
Example on how to use react-jss with Next.js Example on how to use react-jss with Next.js
</h1> </h1>
</div> </div>
) )
} }
export default withStyles(styles)(Index) export default Index
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册