Last active
September 29, 2016 16:19
-
-
Save rickycodes/d3c814cd0e3e41f7d45a926f3e11fae2 to your computer and use it in GitHub Desktop.
react/jsx style props example using Object.assign
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 style from './style' | |
// example usage of Object.assign (needs to be shimmed) to mix things together | |
export default React.createClass({ | |
render() { | |
return ( | |
<aside style={Object.assign({color:'red'}, style.aside)} /> | |
) | |
} | |
}) |
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 style from './style' | |
// example usage of "style" module for style props | |
export default React.createClass({ | |
render() { | |
return ( | |
<aside style={style.aside} /> | |
) | |
} | |
}) |
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
module.exports = { | |
aside: { | |
background: 'black', | |
textDecoration: 'none', | |
width: 200 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment