mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
ee5805da65
Nick Thompson nick-thompson Clarify componentWillMount behavior542f20bCheng Lou chenglou docs fix back link in Examples6b15ad5Cheng Lou chenglou docs add jsx->js tab to live editors7ac5f3cPaul O’Shannessy zpao Normalize line endings6b1c6beBen Alpert spicyj Update homepage for new JSX/JS editor761e1c8Ben Alpert spicyj Properly clear live editor on JSX compile failured3fc5adBen Alpert spicyj Simplify live editor execution logicc7f0663Cheng Lou chenglou [docs] Tweak frontpage first example and jsx-compiler example8c8841cChristoph Pojer cpojer Update propTypes documentation.b66fbdeJean Lauliac jeanlauliac Update broken link in 'why react' article341d292Jean Lauliac jeanlauliac Normalize internal links in 'why react' article0681d13aymanosman aymanosman Fix typo09650e1Bob Eagan bobeagan fix incorrect link2edb76fBob Eagan bobeagan add hash link for lifecycle section of working with the browser page3db3460Pete Hunt petehunt remove references to react-page3120192Ben Alpert spicyj Fix docs typo6e4ddfdPaul O’Shannessy zpao Fix animation example code …dd66223Eric Schoffstall Contra fix grammar mistake64ac427Kunal Mehta kmeht Add documentation about React.renderComponent …f970453Christopher Chedeau vjeux s/Mock DOM/Virtual DOM/ …22772c9Ben Alpert spicyj Disable CodeMirror smart indentation …571d173Ben Alpert spicyj [docs] Fix comma splice3810c83
34 lines
778 B
JavaScript
34 lines
778 B
JavaScript
/**
|
|
* @jsx React.DOM
|
|
*/
|
|
|
|
var TIMER_COMPONENT = "\
|
|
/** @jsx React.DOM */\n\
|
|
var Timer = React.createClass({\n\
|
|
getInitialState: function() {\n\
|
|
return {secondsElapsed: 0};\n\
|
|
},\n\
|
|
tick: function() {\n\
|
|
this.setState({secondsElapsed: this.state.secondsElapsed + 1});\n\
|
|
},\n\
|
|
componentDidMount: function() {\n\
|
|
this.interval = setInterval(this.tick, 1000);\n\
|
|
},\n\
|
|
componentWillUnmount: function() {\n\
|
|
clearInterval(this.interval);\n\
|
|
},\n\
|
|
render: function() {\n\
|
|
return (\n\
|
|
<div>Seconds Elapsed: {this.state.secondsElapsed}</div>\n\
|
|
);\n\
|
|
}\n\
|
|
});\n\
|
|
\n\
|
|
React.renderComponent(<Timer />, mountNode);\
|
|
";
|
|
|
|
React.renderComponent(
|
|
ReactPlayground( {codeText:TIMER_COMPONENT} ),
|
|
document.getElementById('timerExample')
|
|
);
|