mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #203 from spicyj/homepage
Fix all errors and warnings on homepage
This commit is contained in:
@@ -11,7 +11,10 @@ var Timer = React.createClass({\n\
|
||||
this.setState({secondsElapsed: this.state.secondsElapsed + 1});\n\
|
||||
},\n\
|
||||
componentDidMount: function() {\n\
|
||||
setInterval(this.tick, 1000);\n\
|
||||
this.interval = setInterval(this.tick, 1000);\n\
|
||||
},\n\
|
||||
componentWillUnmount: function() {\n\
|
||||
clearInterval(this.interval);\n\
|
||||
},\n\
|
||||
render: function() {\n\
|
||||
return React.DOM.div({},\n\
|
||||
|
||||
@@ -16,7 +16,7 @@ var TodoApp = React.createClass({\n\
|
||||
getInitialState: function() {\n\
|
||||
return {items: [], text: ''};\n\
|
||||
},\n\
|
||||
onKey: function(e) {\n\
|
||||
onChange: function(e) {\n\
|
||||
this.setState({text: e.target.value});\n\
|
||||
},\n\
|
||||
handleSubmit: function(e) {\n\
|
||||
@@ -31,7 +31,7 @@ var TodoApp = React.createClass({\n\
|
||||
<h3>TODO</h3>\n\
|
||||
<TodoList items={this.state.items} />\n\
|
||||
<form onSubmit={this.handleSubmit}>\n\
|
||||
<input onKeyUp={this.onKey} defaultValue={this.state.text} />\n\
|
||||
<input onChange={this.onChange} value={this.state.text} />\n\
|
||||
<button>{'Add #' + (this.state.items.length + 1)}</button>\n\
|
||||
</form>\n\
|
||||
</div>\n\
|
||||
|
||||
@@ -24,7 +24,7 @@ var CodeMirrorEditor = React.createClass({
|
||||
matchBrackets: true,
|
||||
theme: 'solarized-light'
|
||||
});
|
||||
this.editor.on('change', this.onChange.bind(this));
|
||||
this.editor.on('change', this.onChange);
|
||||
this.onChange();
|
||||
},
|
||||
onChange: function() {
|
||||
@@ -40,7 +40,7 @@ var CodeMirrorEditor = React.createClass({
|
||||
if (IS_MOBILE) {
|
||||
editor = <pre style={{overflow: 'scroll'}}>{this.props.codeText}</pre>;
|
||||
} else {
|
||||
editor = <textarea ref="editor">{this.props.codeText}</textarea>;
|
||||
editor = <textarea ref="editor" defaultValue={this.props.codeText} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user