Reputation: 422
I'm using a component that has a property that is required. I want to style that component with said property set and not being required to set it again when rendering. If I don't set it again Typescript complains.
The jist of what I want to do:
const Arrow = styled(<Icon icon={"ArrowRight"}/>)`
...
`;
And not being required to set icon
when rendering.
If I do this
const Arrow = styled(Icon)`
...
`;
Arrow.defaultProps = {
icon: "ArrowRight",
};
I still have to set icon
when rendering.
Is there some way I can achieve this or is my only way out to modify props of Arrow with typescript-magic?
Using
Upvotes: 3
Views: 3656