Is there a way to toggle the rotation of an icon (IconButton) based on the visibility of a Collapse component? I want it to point down when the Collapse is hidden and up when it's shown.
const [expanded, setExpanded] = useState<boolean>(false);
const handleExpand =() => {
setExpanded(!expanded)
}
<Box>
<IconButton onClick={handleExpand}>
<ExpandMoreIcon/>
</IconButton>
<Collapse in={expanded}>Hello</Collapse>
<Box>
I don't want to use an Accordion for this. Any suggestions would be appreciated. Thanks!