4 ms·
We've stopped shipping CSS on green fields client projects. It's been amazing. All of our styles are in JS objects that are applied to inline style tags. It's m
by colinmegill 11y ago
We've stopped shipping CSS on green fields client projects. It's been amazing. All of our styles are in JS objects that are applied to inline style tags. It's modularized like classes are, but there is no cascade so there are no globals. Most importantly, everything can be recomputed at any time - no longer dealing with a static stylesheet.
var globalStyles = require("globalStyles");
var styles = {
color: globalStyles.blue,
padding: foo ? "15px" : "10px",
margin: bar(this.state.qux)
}
We built Radium to solve the problems this causes, like :hover - it's the lib Chan talks about in that React Europe talk christopherscot links to.
http://projects.formidablelabs.com/radium/ http://projects.formidablelabs.com/radium/
I talked at CSSConf about ditching CSS for inline about a month ago:
https://www.youtube.com/watch?v=NoaxsCi13yQ https://www.youtube.com/watch?v=NoaxsCi13yQ