Skip to content

Instantly share code, notes, and snippets.

@iddan
Created March 14, 2017 15:51
Show Gist options
  • Save iddan/7c18a5d857d035d662d05d995743bfb7 to your computer and use it in GitHub Desktop.
Save iddan/7c18a5d857d035d662d05d995743bfb7 to your computer and use it in GitHub Desktop.
css-modules-styled-components
import { Label } from './label.scss';
export default function Form({ fields }) {
return fields.map(field => <div>
<Label color="red" highlighted>{field}</Label>
<input type="text" />
</div>)
}
.Label {
font-size: 18px;
&-highlighted {
background: yellow;
}
&-color-red {
color: red;
}
}
@iddan
Copy link
Author

iddan commented Mar 14, 2017

  • ignore collapsing style props;
  • warn for unknown style prop;
  • style prop can be only primitives

Advantages

  • CSS hot reload and/or separate bundle
  • Control CSS injection manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment