I'm making a React/Next/MUI project, and I wonder how i could set the MUI Collapse element to collapsed by default instead of having it opened (which could be horrible for large navigations). Here's the code :
const [open, setOpen] = React.useState(true);
const handleClick = () => {
setOpen(!open);
};
<ListItem button onClick={handleClick}>
<ListItemText primary="Menu"/>
</ListItem>
<Collapse in={open} timeout="auto" unmountOnExit>
<List component="div" disablePadding>
<ListItem button>
<ListItemIcon>
</ListItemIcon>
<ListItemText primary="Whatever" />
</ListItem>
</List>
</Collapse>
It might be something quite simple, but I'm not familiar with MUI API... If you need further details, let me know ! Thanks for the help and the great community !