-
Notifications
You must be signed in to change notification settings - Fork 95
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
Question about syntax #114
Comments
The idea is that you don't use class names or inline styles at all - you only style a component with |
I understand the main idea, but for example I have the real workcase. |
<div
{...css(
style.myFirstClass,
condition && style.mySecondClass,
)}
/> |
I'll go ahead and add that for incremental migration, this causes a problem - you can't mix regular CSS classes with |
@chenasraf indeed, incremental migration is only possible when your component is fully self-contained - my suggestion would be to start with a leaf, fix all places where it’s being overridden with css and change them to use props, and then you can migrate that leaf to react-with-styles. |
I do agree with Edit: I dont know if adding external static classnames via props is currently possible, at least it is not clear enough how to do that on the current documentation. |
Our answer to that is theming, via react-with-styles. |
So, if I want to make a shareable component and I want it to be flexible allowing the other party to add their own classnames in the inner pieces of my code then the solution is to make the other party add an additional dependency to their project (and learn how to use it) instead of using the usual pattern of a simple prop? I apologize if im not understanding something basic, but it seems to me that it goes totally agaisnt the main premise of this library, citing from the very first line of the readme: Edit: I want to clarify something, i'm not complaining for the sake of complaining, my case is that i'm reading through the source code of react-dates looking for a way to override some style choices that it has, probably making a fork if i have to, and I stumbled upon this library. |
https://brigade.engineering/don-t-pass-css-classes-between-components-e9f7ab192785 is a great article on the subjet. |
Hi, Yesterday I took your package to replace withStyles from material-ui for yours.
I have a question about construction
<div ...css(styles.classname1, styles.classname2)/>
As for me that syntax is slightly redundant and also with that I can't use "classname" package, as example:
{ classnames(css(styles.classname1)), {classnames(css(styles.classname2)): this.state.error } }
, or simply add some static styles, as example:<div className="error", {...css(styles.classname)}>
or<div className={classname({ classnames(css(styles.classname1)), {error: this.state.error})}
.It's only two cases that I've run into in a few days.
I've wrapped some methods and now it works as always, as example:
<div className={classnames(styles.firstLink, styles.secondLink, {error: true})}>
That's work with JSS and Aphrodite.
Methods that I wrap:
So, maybe I don't know or missed something, please explain for me why you chose this approach.
The text was updated successfully, but these errors were encountered: