Reputation: 875
I'm getting the below error when using react and material UI
TypeError: Cannot read property 'spacing' of undefined
Here is the code:
buttonTeal: {
margin: theme.spacing(1),
color:'white',
backgroundColor: '#009688',
And its being rendered by
const classes = useStyles();
Upvotes: 1
Views: 2258
Reputation: 875
I got it, I moved the styles into the hook and changed
export default withStyles(useStyles)(Hookname);
to
export default Hookname;
and added
const useStyles = makeStyles(theme => ({
Rather than
const useStyles = theme => ({
Upvotes: 2