I'm currently training on ReactJS. I'm using material-ui and JSS (totally new for me).
I don't understand how can I simply select my H6 element or my H6 children elements (dangerStyle).
Any idea ?
Thanks !
myJss.js
const myJss = theme => ({
textCenter : {
textAlign:'center'
},
dangerStyle: {
fontWeight:'normal',
color:"#FF0000"
},
h6: {
color:"#00FF00",
"&.dangerStyle" : {
fontWeight:'bold',
}
}
});
export default myJss;
app.js
import React, { Component } from 'react'
import { withStyles } from "@material-ui/core/styles";
import Danger from 'components/danger'
import myJss from 'assets/jss/myJss.js';
class App extends Component {
constructor (props) {
super(props)
}
render () {
const { classes } = this.props;
return (
<div>
APP
<h6>
<Danger>Error occured</Danger>
</h6>
</div>
)
}
}
export default withStyles(myJss)(App)
danger.js
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import myJss from 'assets/jss/myJss.js';
const useStyles = makeStyles(myJss);
export default function Danger(props) {
const { children } = props;
const classes = useStyles();
return (
<div className={classes.dangerStyle}>
{children}
</div>
);
}
h6 .dangerStyle
entry? If so, then you should just be able to do<div className="dangerStyle">
– Eulogist