Material-UI withStyles doesn't apply any kind of styles

前端 未结 1 1860
既然无缘
既然无缘 2020-12-12 05:42

I used the example in Material-UI for an AppBar and I simply changed it from a function to a class component, after that I looked at how to use

相关标签:
1条回答
  • 2020-12-12 06:22

    You should not be trying to use makeStyles along with withStyles. makeStyles returns a custom hook and passing this custom hook into withStyles will not work correctly.

    Instead, you want the following:

    const styles = theme => ({
        grow: {
            flexGrow: 1,
            zIndex: 1000,
        },
        /* and all your other styles ... */
    });
    
    // other stuff (e.g. your SideDrawer component) ...
    
    export default withStyles(styles)(SideDrawer);
    
    0 讨论(0)
提交回复
热议问题