How can react select an item in the list and change the background color?

  node.js, question

clipboard.png
If you want to change the background color of a selected row in the click list and click this item, cancel it.
However, this is the real dom operation after dom rendering. Is the real dom capable of using setState
What is the idea of realization

Why not, give you a simple example:

jsFiddle

<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>
var Hello = React.createClass({
 getInitialState: function() {
 return {checked: false};
 },
 render: function() {
 var rowStyle = {
 backgroundColor: this.state.checked ?  'blue' : 'transparent'
 };
 console.log(rowStyle);
 return <div onClick={this.handleClick} style={rowStyle}>Hello {this.props.name}</div>;
 },
 
 handleClick: function(){
 this.setState({
 checked: !  this.state.checked
 });
 bracket
 });
 
 ReactDOM.render(
 <Hello name="World" />,
 document.getElementById('container')
 );