Hei. I am using MUI within a React project. I have just upgraded to v5 and I got a couple of issues with my stylings:
TypeError: theme.spacing is not a functionTypeError: Cannot read properties of undefined (reading 'primary')
I am using typescript and importing things like so:
import { Theme } from "@mui/material"
import { makeStyles } from "@mui/styles"
And then I am trying to create my classes as I did in v4:
const useStyles = makeStyles((theme: Theme) =>
  createStyles({
    avatar: {
      width: theme.spacing(3),
      height: theme.spacing(3),
      backgroundColor: theme.palette.primary.light,
    }
  })
);
And then I am using it in my component:
const classes = useStyles();
However the first error is thrown. If I delete the lines with the spacing I am getting the second error, so there might be something that I am missing here as nothing seems to work.