Вот вам полный пример, надеюсь, это решит вашу проблему:
import React from 'react'
import { makeStyles } from '@material-ui/styles'
import IconButton from '@material-ui/core/IconButton'
import AddBoxIcon from '@material-ui/icons/AddBox'
import IndeterminateCheckBoxIcon from '@material-ui/icons/IndeterminateCheckBox'
export default () => {
const [showForm, setShowForm] = React.useState(false)
const classes = useClasses()
return (
<IconButton
classes={{
root: classes.iconContainer
}}
>
{!showForm
? <AddBoxIcon className={classes.icon}/>
: <IndeterminateCheckBoxIcon className={classes.icon}/>
}
</IconButton>
)
}
const useClasses = makeStyles(theme => ({
iconContainer: {
"&:hover $icon": {
color: 'red',
}
},
icon: {
color: 'blue',
},
}))