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

update/with-react-jss (#15156)

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