I'm trying to change the style of a styled-components element when another element is hovered over, however it doesn't seem to apply those changes.
The piece of relevant code is,
const Logo = styled.div`
. . .
&:hover {
color: red;
${TextStyled} {
display: flex;
}
}
`;
The color of the Logo component successfully changes to red on hover, however the display property of the TextStyled component doesn't seem to be affected.
What am I doing wrong here? I've tried adding a tilde before ${TextStyled}, but that selector didn't work either.
I've also tried applying the style through the parent Main component, but that didn't work either:
const Main = styled.div`
height: 100vh;
width: 100vw;
background: #000;
${Logo} {
&:hover {
color: red;
${TextStyled} {
display: flex;
}
}
}
`;