Skip to content

Instantly share code, notes, and snippets.

@sebjwallace
Last active April 24, 2016 13:22
Show Gist options
  • Save sebjwallace/0f9a0b21e834ea34630a638f218d2b0f to your computer and use it in GitHub Desktop.
Save sebjwallace/0f9a0b21e834ea34630a638f218d2b0f to your computer and use it in GitHub Desktop.
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