I have
var TestApp = React.createClass({
getComponent: function(){
console.log(this.props);
},
render: function(){
retur
Why not:
onItemClick: function (event) {
event.currentTarget.style.backgroundColor = '#ccc';
},
render: function() {
return (
- Component 1
);
}
And if you want to be more React-ive about it, you might want to set the selected item as state of its containing React component, then reference that state to determine the item's color within render:
onItemClick: function (event) {
this.setState({ selectedItem: event.currentTarget.dataset.id });
//where 'id' = whatever suffix you give the data-* li attribute
},
render: function() {
return (
- Component 1
- Component 2
- Component 3
);
},
You'd want to put those s into a loop, and you need to make the li.on and li.off styles set your background-color.