Last active
April 24, 2016 13:22
-
-
Save sebjwallace/0f9a0b21e834ea34630a638f218d2b0f to your computer and use it in GitHub Desktop.
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
function extend(base, derivative){ | |
for(var i in base) | |
if(!derivative[i]) | |
derivative[i] = base[i] | |
return derivative | |
} | |
var base = { | |
color: '#555', | |
fontSize: '2em' | |
} | |
var box = extend(base, { | |
padding: '10px', | |
backgroundColor: '#ddd' | |
}) | |
function Hello(name, styles){ | |
return ["div", {style:styles}, "Hello " + name] | |
} | |
ReactDOM.render( | |
React.createElement.apply( | |
this, Hello("World", box) | |
), | |
document.getElementById('container') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment