I have
var TestApp = React.createClass({
getComponent: function(){
console.log(this.props);
},
render: function(){
retur
Use ECMA2015. Arrow functions make "this" a lot more intuitive.
import React from 'react';
class TestApp extends React.Component {
getComponent(e, index) {
$(e.target).css({
'background-color': '#ccc'
});
}
render() {
return (
- this.getComponent(e, 1)}>Component 1
- this.getComponent(e, 2)}>Component 2
- this.getComponent(e, 3)}>Component 3
);
}
});
React.renderComponent( , document.getElementById('soln1'));`