-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inherited prop className #4341
Comments
What if you wanted to override it though? I think in this situation it's better for React to be less opinionated and leave it up to the implementor. It would be pretty straightforward to implement this as a mixin, too. |
Yeah, we strive to implement the most general and explicit solutions, so long as we don't introduce excessive burden on the developer. A single call to I'm going to close this out, since I'm fairly certain this is not something we want to do. Feel free to continue the discussion on this thread. |
Hey,
we have been recently using React (+Flux) in our project and we approached a quite intriguing problem. Following the WebComponents-like approach, we try to create a bunch of reusable components with similar behaviours. The problem arises when we want to put the same component, with the same 'logic', on a different view, with a different design (that be -> a different CSS class attached). We need to create the same component with different set of class' names (+usually a few default ones) and right now it seems to be only possible by passing props like
classes
orinheritedCls
._tl;dr;_ It would be really cool if React passed the
className
from the component definition to it's actual DOM elements. That would save us creating and passing aclasses
props, ex.:_Initialization in a parent component_:
_Current way of appending 'inherited' classes_:
_Nicer and simpler way:_
I would love to hear your opinions on that. We needed such functionality in the project and ended up passing the inherited class' names by props, which feels a little inelegant.
The text was updated successfully, but these errors were encountered: