-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(FIX) Remove answers from 'src/app.jsx'
- Loading branch information
Showing
1 changed file
with
1 addition
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,3 @@ | ||
'use strict'; | ||
|
||
var React = require('react'); | ||
|
||
var boxStyle = { | ||
width: '100px', | ||
height: '100px' | ||
}; | ||
|
||
var Box = React.createClass({ | ||
getInitialState: function(){ | ||
return { | ||
value: 'X' | ||
}; | ||
}, | ||
handleClick: function(){ | ||
var oldValue = this.state.value; | ||
var newValue= oldValue === 'X' ? 'O': 'X'; | ||
this.setState({ | ||
value: newValue | ||
}); | ||
}, | ||
render: function(){ | ||
return ( | ||
<button style={boxStyle} onClick={this.handleClick}>{this.state.value}</button> | ||
); | ||
} | ||
}); | ||
|
||
var Row = React.createClass({ | ||
render: function(){ | ||
return ( | ||
<div> | ||
<Box/> | ||
<Box/> | ||
<Box/> | ||
</div> | ||
) | ||
} | ||
}) | ||
|
||
React.render(<Row/>, document.body) | ||
var React = require('react'); |