2021年1月25日星期一

Target CSS child selector created by in material ui

I have styles like this:

const useStyles = makeStyles(theme => ({    root: {      margin: 5    },    container: {      backgroundColor: 'red'    },    active: {      // here I want to target the 'container' className I created above like      '& .container': {        backgroundColor: 'green'      }    }  });  

I want to target the container className I created inside of the active className. The above won't work because in the DOM, MUI will generate a unique name so I won't be targeting the right class. Wasn't able to find any SO answer or blog or documentation addressing this.

https://stackoverflow.com/questions/65895691/target-css-child-selector-created-by-in-material-ui January 26, 2021 at 11:57AM

没有评论:

发表评论