Add extra styles to a child component #1594
Unanswered
commscheck
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Say I have a self-contained component that knows how to style itself:
But when I use that component, I want to add some extra styles, e.g. for positioning in a CSS grid:
How can I add the additional styles? The child component shouldn't need to know how it's positioned within its parent, so I don't want to add them to
MyComponentProps
.I considered creating a
GridItem
HOC to wrap items that go in the grid, but that would require nesting each item in an extradiv
. Is there a cleaner approach? Cheers!Beta Was this translation helpful? Give feedback.
All reactions