Last active
August 29, 2015 14:13
-
-
Save supermario/4d27d5aeb66197ef3642 to your computer and use it in GitHub Desktop.
SoundCloud React POC!
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello React</title> | |
<script src="http://fb.me/react-0.12.1.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.12.1.js"></script> | |
</head> | |
<body> | |
<div id="example"></div> | |
<script type="text/jsx"> | |
var SoundCloudPlayer = React.createClass({ | |
getInitialState: function() { | |
return {url: 'https://w.soundcloud.com/player/?url=http://soundcloud.com/young-shift/leaning-prod-by-young-shift-bregang-snippet&auto_play=true'}; | |
}, | |
handleClick: function() { | |
this.setState({url: 'https://w.soundcloud.com/player/?url=http://soundcloud.com/young-shift/leaning-prod-by-young-shift-bregang-snippet&auto_play=true'}); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<iframe src={this.state.url}></iframe> | |
<button onClick={this.handleClick} /> | |
</div> | |
); | |
} | |
}); | |
React.render( | |
<SoundCloudPlayer />, | |
document.getElementById('example') | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment