'Props with styles not applying until I change file (Material UI)
export const useStyles = makeStyles((theme: Theme) =>
createStyles({
switchBase: (props) => {
return {
"& .MuiIconButton-root": {
//@ts-ignore
color: props.inputBoxColor,
},
"& .Mui-checked": {
//@ts-ignore
color: "props.inputBoxColorFocused,
},
"&.Mui-checked + .MuiSwitch-track": {
//@ts-ignore
backgroundColor: props.inputBoxColorFocused,
},
};
},
})
);
The user can change the color and it gets updated in state. I passed it in here. It dosent work until I change something in the file. But when I refresh again it dosent get applied. My guess is that the props are not intiallized yet. But it still dosent work when the state gets changed. Only when the file is changed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
