【发布时间】:2020-01-28 10:31:09
【问题描述】:
Material-UI Box component 允许我们引用其他组件,如下所示:
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>
)
}
这不起作用。
知道为什么不这样做以及如何让它工作吗?
谢谢。
【问题讨论】:
标签: reactjs material-ui