I have a question about styled components and what happens when a styled component is referenced in another styled component.
I know the official docs with the Link example, but I do not understand what exactly happens when a styled component is referenced.
So my question: in the following example - do the references ${A}, ${B} pass their styling to the wrapper? or only referencing to it, so change specific attributes.
How is this handled under the hood?
e.g.:
const A = styled.div`
background-color: red;
margin-top: 10px;
`
const B = styled.div`
background-color: blue;
`
const Wrapper = styled.div`
${A}, ${B} {
background-color: green;
}
`
export const NiceComponent: React.FC = () => {
return (
<Wrapper>
<A />
<B />
</Wrapper >
);