我想创建一个可重复使用的" IconButton"使用styled-components扩展Rebass Button,但我收到此警告:
Unknown props 'small, 'overlay' on <button> tag. Remove these props from the element
如何从元素中删除这些道具?
export default ({
...props,
type,
action,
top,
small,
overlay
}) =>
<IconButton
onClick={() => action()}
px={3}
mt={top && 2}
small={small}
overlay={overlay}>
{Icons[type]()}
</IconButton>;
const IconButton = styled(Button)`
background: ${({ overlay }) => (overlay ? "white" : "transparent")};
svg {
height: ${props =>
props.small ? props.theme.fontSizes[4] : props.theme.fontSizes[5]}px;
width: ${props => props.theme.fontSizes[5]}px;
}
`;