A simple Reddit Client with React JS
A recreation of the Reddit client created with Montage JS at http://montagejs.org/docs/tutorial-reddit-client-with-montagejs.html
by chimco_89
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.2/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.2/react-with-addons.min.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<body>
</body>
JavaScript 1.7
var Image = React.createClass({
getInitialState() {
return {
src: 'http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg'
};
},
onClick() {
this.setState({src: 'https://www.imotors.com/Images/Default/small_car.jpg'});
},
render() {
return (
<div>
<img src={this.state.src} />
<button onClick={this.onClick}>Change Image!</button>
</div>
);
}
});
React.render(<Image />, document.body);