Skip to content

Instantly share code, notes, and snippets.

@supermario
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save supermario/4d27d5aeb66197ef3642 to your computer and use it in GitHub Desktop.
Save supermario/4d27d5aeb66197ef3642 to your computer and use it in GitHub Desktop.
SoundCloud React POC!
<!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