DEV Community

Discussion on: Why I don't like to use Styled-Components

Collapse
 
mbwatson profile image
Matt Watson • Edited

the style passed into a styled component is just a parameter passed into a method -- button in this case -- so you could do

const StyledWrapper = styled.button('')

if you don't like

const StyledWrapper = styled.button''.

Collapse
 
buriti97 profile image
buridev

And also it can be import like import * as S from ./your-styled-component-file .
And use:

<S.Button>Your button Text</S.Button>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
ucvdesh profile image
Daniel Silva

But, that's a compound component pattern...not a styled-component pattern

Collapse
 
ucvdesh profile image
Daniel Silva

Maybe what you can do is

const StyledWrapper = styled.button([``])
Enter fullscreen mode Exit fullscreen mode

As the documentation says:
dev-to-uploads.s3.amazonaws.com/up...

But, still not a good way to do it and again, unnatural syntax. Also, even typescript is giving me an error because it's not a string that's expecting but a TemplateStringArrays and when I try to do it always gives me an Ts error