Reputation: 10581
I have a <Header />
component, which takes a size
prop. I want to take a Header with a size
prop, and additionally style it with styled-components
.
Something like the following, but this obviously doesn't work.
const MyHeader = styled(<Header size="huge />)`
margin-top: 2rem;
`
Any ideas how to achieve that?
Upvotes: 0
Views: 725
Reputation: 17269
You can do:
const MyHeader = styled(Header)({ ... });
For example:
const MyHeader = styled(Header)`
color: red;
`
Or if you want:
const Temp = () => <Header size="huge" />;
const MyHeader = styled(Header)({ ... });
Upvotes: 1