This Gist was automatically created by Carbide, a free online programming environment.
Created
October 6, 2016 22:22
-
-
Save billymoon/4f1be594a4acd526155521b929caac27 to your computer and use it in GitHub Desktop.
untitled
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 React from 'react' | |
import ReactDOM from 'react-dom' | |
import $ from 'jquery' | |
var app = $('<div>').attr({id: 'app'}) | |
$(document.body).html(app) | |
$(document.head).append('<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/g/bootswatch(darkly/bootstrap.min.css)">') | |
var Button = React.createClass({ | |
render: function() { | |
return (<button className={'btn ' + 'btn-default'} onClick={this.props.click}>{this.props.children}</button>) | |
} | |
}) | |
var Container = React.createClass({ | |
render: function() { | |
return ( | |
<div className="container" style={this.props.style}> | |
{this.props.children} | |
</div> | |
) | |
} | |
}) | |
var containerStyle = { | |
marginTop: '2em' | |
} | |
var clicker = function(){ console.log('clicked') } | |
ReactDOM.render(<Container style={containerStyle}><Button click={function(){ console.log(312123) }}>Super duper</Button></Container>, app[0]) |
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
body { | |
margin-top: 2em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment