I have incorporated Mui v5 components into my project and currently I am utilizing sx props to style all the MUI components. However, it is becoming cumbersome to add sx in every line for each component. Therefore, I am seeking alternative methods for styling or applying custom classes to each component similar to how it is done in styled-components library. Although I am aware of styled from MUI which is used for creating reusable components, I am looking for a solution that allows me to prepare styles that can be applied to any component.
Below is an example of my code:
const theme = useTheme();
return (
<Box className="custom-style">
<Box
className="inner-box"
>
</Box>
<Box className="chart-container">{AreaChartComp}</Box>
</Box>
);
};
In the provided code snippet, you can see that I had to use sx three times, which is not ideal. Thus, I am exploring other options where I can simply pass classes instead.