the style passed into a styled component is just a parameter passed into a method -- button in this case -- so you could do
button
const StyledWrapper = styled.button('')
if you don't like
const StyledWrapper = styled.button''.
const StyledWrapper = styled.button''
Maybe what you can do is
const StyledWrapper = styled.button([``])
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
TemplateStringArrays
And also it can be import like import * as S from ./your-styled-component-file . And use:
import * as S from ./your-styled-component-file
<S.Button>Your button Text</S.Button>
But, that's a compound component pattern...not a styled-component pattern
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
the style passed into a styled component is just a parameter passed into a method --
buttonin this case -- so you could doconst StyledWrapper = styled.button('')if you don't like
const StyledWrapper = styled.button''.Maybe what you can do is
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
TemplateStringArraysand when I try to do it always gives me an Ts errorAnd also it can be import like
import * as S from ./your-styled-component-file.And use:
But, that's a compound component pattern...not a styled-component pattern