React Base Fiddle (JSX)
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://npmcdn.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
JavaScript 1.7
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.changeSlide = this.changeSlide.bind(this);
}
changeSlide(e) {
e.preventDefault();
console.log('e.target.value', e.target.value);
}
render() {
return (
<div>
<button
onClick={this.changeSlide}
value="back">
<img src="//www.gravatar.com/avatar/7150a453468d14f599772cd8330fcf25/?default=&s=80" alt="Previous slide" />
</button>
<button
onClick={this.changeSlide}
value="back">
CLICK ME
</button>
</div>
)
}
}
ReactDOM.render(
<MyComponent />,
document.getElementById('container')
);