Tailwind-Styled-Component icon indicating copy to clipboard operation
Tailwind-Styled-Component copied to clipboard

withComponent function not supported

Open sabres207 opened this issue 3 years ago • 1 comments

Hey guys, thanks for the awesome library. I noticed there is no way to pass tw an Element to wrap on the fly. in styled-components I think you could do it with:

const StyledComponent = styled.div``
StyledComponent.withComponent(OtherComponent)

Got any idea how to use tailwind-styled-component with a component that is decided on runtime? Thank you!

sabres207 avatar Apr 06 '22 14:04 sabres207

Doesn't this work?

const StyledComponent = styled.div``
const newComponent = tw(StyledComponent)``

MathiasGilson avatar Apr 14 '22 23:04 MathiasGilson