Created
October 28, 2014 16:47
-
-
Save geolessel/4a72ce97edd2b21f12e3 to your computer and use it in GitHub Desktop.
First try at react.js
This file contains hidden or 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
<html> | |
<head> | |
<script src="http://fb.me/react-0.11.2.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.11.2.js"></script> | |
</head> | |
<body> | |
<h1>Facebook Profile Picture Loader</h1> | |
<p>Just enter the username of the user you'd like to see</p> | |
<div id='pic'></div> | |
<script type='text/jsx'> | |
/** @jsx React.DOM */ | |
var PicLoader = React.createClass({ | |
getInitialState: function() { | |
return {value: 'geoffrey.lessel'}; | |
}, | |
handleChange: function(event) { | |
this.setState({value: event.target.value}); | |
}, | |
render: function() { | |
return ( | |
<div> | |
Profile pic for {this.state.value}<br /> | |
<input type="text" value={this.state.value} onChange={this.handleChange} /><br /> | |
<img src={'http://graph.facebook.com/' + this.state.value + '/picture'} /> | |
</div> | |
); | |
} | |
}) | |
React.renderComponent(<PicLoader />, document.getElementById('pic')); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment