I am looking to create a functional stateless component in ReactJs following the guidelines outlined here.
const MyBlueButton = props => {
const styles = { background: 'blue', color: 'white' };
return <button {...props} style={styles} />;
};
However, I also want to incorporate some styles from stateful components as explained here.
const styles = theme => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
});
The issue arises when trying to apply these styles using:
<div className={classes.root}>
This results in an error message stating:
'classes' is not defined no-undef
How can I access the withStyles
classes
object to properly style the root
element?