最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Modal doesn't show up - Stack Overflow

programmeradmin1浏览0评论

I'm trying to launch MUI modal in my Laravel Inertia React project, but the modal doesn`t show up and doesn't give any error, please help

    const [open, setOpen] = useState(false);
    const handleOpen = () => setOpen(true);

    const handleClose = () => setOpen(false);

                <div>
                    <Button onClick={handleOpen}>Open modal</Button>
                    <Modal
                        keepMounted
                        open={open}
                        onClose={handleClose}
                        aria-labelledby="keep-mounted-modal-title"
                        aria-describedby="keep-mounted-modal-description"
                    >
                        <Box sx={style}>
                            <Typography
                                id="keep-mounted-modal-title"
                                variant="h6"
                                component="h2"
                            >
                                Text in a modal
                            </Typography>
                            <Typography
                                id="keep-mounted-modal-description"
                                sx={{ mt: 2 }}
                            >
                                Duis mollis, est non commodo luctus, nisi erat
                                porttitor ligula.
                            </Typography>
                        </Box>
                    </Modal>
                </div>

I tried to make a Tailwindcss modal and it doesn't show either

发布评论

评论列表(0)

  1. 暂无评论