Search code examples
reactjsuser-interfacestyled-components

styled(x) VS styled.x in styled component


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?


Solution

  • 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)