3 ms·
Could be a little simpler if you're using an ES6 transpiler. import styles from './styles/global'; const thisButton = { ...styles.button, custom: stuff };
by sim0n 11y ago
Could be a little simpler if you're using an ES6 transpiler.
import styles from './styles/global';
const thisButton = { ...styles.button, custom: stuff };
Also, nth-child and similar selectors aren't too bad, especially if you use a [1]helper library on top of React that lets you pass an array of styles to a component. All it then usually requires is adding a test against the iterator index when rendering a list of data. Something like:
this.props.list.map((entry, index) => {
const style = [styles.row, index % 2 === 0 && styles.even];
return (<div style={style}>{entry}</div>);
});
A little bit of extra code but so much that I find it to be an issue.
[1] https://github.com/FormidableLabs/radium https://github.com/FormidableLabs/radium