Looking for guidance on how to update a property value of a component in Next.js. I have been using the Material-UI library for styling.
Encountering an issue when attempting to modify the 'open' property of a drawer component, as it constantly displays a [TypeError] stating that 'open' is read-only.
const drawer = (
<SwipeableDrawer open={drawerOpened}>
<div tabIndex={0} role="button">
{sideList}
</div>
</SwipeableDrawer>
);
const handleClick = e => {
drawerOpened = !drawerOpened;
drawer.props.open = drawerOpened;
e.preventDefault();
};
const Index = () => (
<div className={styles.root}>
<AppBar position="static">
<Toolbar>
<IconButton
className={styles.menuButton}
color="inherit"
aria-label="Menu"
onClick={handleClick}
>
<MenuIcon />
</IconButton>
<Typography variant="h6" color="inherit" className={styles.grow}>
Example
</Typography>
<Button color="inherit" style={{ right: "0px", position: "absolute" }}>
Login
</Button>
</Toolbar>
</AppBar>
{drawer}
</div>
);