-
-
Notifications
You must be signed in to change notification settings - Fork 106
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
The order of props should not matter #326
Comments
That's a fascinating bug, and well-explained, thanks! Order matters in CSS, therefore order matters in props. Without preserving order, you wouldn't have a workaround. Additionally, the order of props is important because otherwise the caller has to know the specific props to override: const Foo = props => <x.div borderColor="red" {...props} />
<Foo border="2px solid green" /> The final border should be green, not red, and the caller shoudn't need to know that the inner component used About your ideal case, we might be able to do something for simplistic cases. The problem is that it gets tricky with complex space-separated values, and there's limited value to increasing the complexity of the code to handle them. But I can imagine handling the simple cases at some point. For now, though, have you considered using |
Glad it got your attention :D. I can use |
What's even more interesting about this behavior is that the docs generate something entirely different:
produces:
Doing that same thing locally I get:
|
馃挰 Questions and Help
I noticed that
and
will produce different results. It's because the last one will generate:
and the default color (black) for
border-bottom
will overrideborder-color
. Is there a better way to write it so that I don't have to remember that ordering props matter?Ideally, is it possible to make the following code a reality?
Thanks! :)
The text was updated successfully, but these errors were encountered: