【发布时间】:2021-12-15 08:25:59
【问题描述】:
export default function ProjectCard1() {
const [open, setOpen] = React.useState(false);
const handleClick = () => {
setOpen(true).then(response => {
window.open("https://project-uts-teori.vercel.app/");
});
};
const handleClose = (event, reason) => {
if (reason === 'clickaway') {
return;
}
setOpen(false);
};
它说 TypeError: Cannot read properties of undefined (reading 'then')。我需要先显示警报消息,然后再将它 window.open 到站点。
【问题讨论】:
-
你可以使用this语法。
标签: reactjs material-ui