I'm struggling to grasp styling changes in MUI 5. I have a bunch of styling which was working fine in Material UI 4 but when trying to apply the same styling in MUI 5 my web inspector shows it as an [object] instead of the CSS class name when used with sx.
For example, I created test case below and the only style that is actually working is 'myBorder' with style prop. sx isn't working. Can anyone shed some light on what I'm doing wrong, newbie here?
import * as React from "react";
const styles = {
myBackground: {
backgroundColor: "red"
},
myBorder: {
border: "2px solid green"
},
myFont: {
color: "blue"
}
};
export default function Index() {
return (
<div
sx={styles.myBackground}
style={styles.myBorder}
classes={styles.myFont}
className={styles.myFont}
maxWidth="sm"
>
This is a test
</div>
);
}
See codepen at https://codesandbox.io/s/mui-5-styling-uqt9m?file=/pages/index.js