MathiasGilson / Tailwind-Styled-Component

Create Tailwind CSS React components like styled components with class names on multiple lines and conditional class rendering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

withComponent function not supported

sabres207 opened this issue · 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!

Doesn't this work?

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