How to use useStyle to style Class Component in Material Ui

前端 未结 5 1886
我寻月下人不归
我寻月下人不归 2020-12-14 14:39

I want to use useStyle to style the Class Component . But this can be easily done hooks. but i want to use Component instead. But I cant figure out how to do this.

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 14:56

    Hey I had a similar problem. I solved it by replacing makeStyles with withStyles and then at the point where do something like const classes = useStyle();, replace that with const classes = useStyle;

    You notice useStyle is not supposed to be a function call but rather a variable assignment.

    That should work fine after you've made those changes.

提交回复
热议问题