Home > Mobile >  styled(x) VS styled.x in styled component
styled(x) VS styled.x in styled component

Time:08-05

I'm new to using styled-component and i did read the styled component document and it said they do the same job , then why we use styled(x) if Styled.x is enough?

CodePudding user response:

styled.x will only work if x is an html tag. If you want to style a component C, you would use styled(C), otherwise you would get an error because C is not a property of "styled" (you can't access styled.C)

  • Related