so how i use styled components is that the main container in the component is a styled component and everything inside the components are normal classes,
export const StyledContainer = styled.div({currentColor:string}) => {
//style here are for styling the component itself, then you can add classes which are elements inside the styled component
padding:30px;
margin:20px
....
//element with a className inside the styled component, the styled component takes a color props and passes it to the className
.box__red_or_blue {
color: ${props} => props.currentColor === "red" ? "red" : "blue"}
}
}
since styled-components generate classes for each component, it will be hard to get clashes as the elements with classes and encapsulated and embedded with the styled component
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.
so how i use styled components is that the main container in the component is a styled component and everything inside the components are normal classes,
example
COMPONENT.TSX
COMPONENT.STYLE.TS
since styled-components generate classes for each component, it will be hard to get clashes as the elements with classes and encapsulated and embedded with the styled component