Assuming all the other ducks are in order, you can track the class in the state of the components, and then update the state using logic in the onClick event.
var TableData = React.createClass({
getInitialState: function() {
return {
class: 'pointer'
};
},
changeStyle: function(e) {
if (this.state.class === 'pointer') {
this.setState({class: 'not pointer'});
} else {
this.setState({class: 'pointer'});
}
},
render: function() {
return (
<td style={ cursor: {this.state.class} }
onClick={this.changeStyle}
key={i}>
</td>
);
}
});
source
share