Using the sibling selector together with props #3323
|
Yesterday, I ran into the following issue: As long as two siblings have the same type, this works fine. But if type a and type. b are next to each other, the classes differ and the sibling selector is no longer applied. Normally in CSS, I would add a secondary class for the colors and use the class with the shared styles for the sibling selector. I know I can add a className to the Banner component and use that for the sibling selector, but it feels like a hack. Can I solve it in a better way, that matches more with the "Emotion" way? |
Answered by
nullisdefined
Mar 30, 2025
Replies: 1 comment
|
The usual answer is - don't do this. Don't introduce such contextual styles. However, if you really want this you can do this (when using our Babel plugin): |
0 replies
Answer selected by
hubsugar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The usual answer is - don't do this. Don't introduce such contextual styles.
However, if you really want this you can do this (when using our Babel plugin):