Material-UI Box 组件允许我们引用其他组件,如下所示:
import Button from "@material-ui/core/Button";
import Box from "@material-ui/core/Box";
const NewButton = ({ children }) => (
<Box compoment={Button} px={3} py={1} color="white" bgcolor="primary.dark">
{children}
</Box>
)
这就像我想要的那样工作。但是,现在让我尝试使用 Drawer 组件:
import Drawer from "@material-ui/core/Drawer";
import Box from "@material-ui/core/Box";
const NewDrawer = ({ children, open }) => {
return (
<Box component={Drawer} width="300px" bgcolor="secondary.dark">
{children}
</Box>
)
}
这不起作用。
知道为什么不以及如何让它工作吗?
谢谢。