Reactjs 使用道具的材质UI修改器类样式无效

Reactjs 使用道具的材质UI修改器类样式无效,reactjs,material-ui,Reactjs,Material Ui,尝试基于内部选择器(“&$selected”和“&:hover”)的道具设置颜色。但是没有应用颜色,尽管我可以看到应用了与所选内容相关的类 const getColor=(颜色,主题)=>{ 返回颜色=='primary' ?theme.palette.primary.Text :color=='secondary' ?theme.palette.secondary.Text :theme.palete.action.active; }; const getBgColor=(颜色,主题)=>{

尝试基于内部选择器(“&$selected”和“&:hover”)的道具设置颜色。但是没有应用颜色,尽管我可以看到应用了与所选内容相关的类

const getColor=(颜色,主题)=>{
返回颜色=='primary'
?theme.palette.primary.Text
:color=='secondary'
?theme.palette.secondary.Text
:theme.palete.action.active;
};
const getBgColor=(颜色,主题)=>{
返回颜色=='primary'
?theme.palete.primary.main
:color=='secondary'
?theme.palete.secondary.main
:theme.palete.action.active;
};
const useStyles=makeStyles(主题=>({
根目录:{
textTransform:“无”,
//这不会应用设置的颜色
“&$selected”:{
颜色:({color})=>getColor(颜色,主题),
背景颜色:({color})=>
getBgColor(颜色、主题),
//这一点也不适用
“&:悬停”:{
背景颜色:({color})=>
getBgColor(颜色、主题),
},
},
},
选定:{},
}))

需要更多关于使用这些样式的组件的代码请创建一个重现您的问题的代码。