Created
August 7, 2017 19:14
-
-
Save jaketrent/d7001b870952a5616a85543b1c207ebd to your computer and use it in GitHub Desktop.
glamorous glamor.css as className
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<P className={glamor.css({ color: 'blue' })}>wow</P> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glamorous from 'glamorous' | |
import React from 'react' | |
const P = glamorous.p({ | |
color: 'red', | |
}) | |
export default props => <P {...props} className={`${props.className}`} /> | |
// works! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glamorous from 'glamorous' | |
import React from 'react' | |
const P = glamorous.p({ | |
color: 'red', | |
}) | |
export default props => <P {...props} /> | |
// errors with: | |
// VM128 preview.bundle.js:830 Warning: Failed prop type: Invalid prop `className` of type `object` supplied to `glamorous(p)`, expected `string`. | |
// in glamorous(p) | |
// in Unknown (created by BackgroundDecorator) | |
// in div (created by BackgroundDecorator) | |
// in BackgroundDecorator | |
// also errors: | |
// export default props => <P {...props} className={props.className} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples seem to always cast this way:
https://glamorous.rocks/basics/