Skip to content

Instantly share code, notes, and snippets.

@cozos
Last active November 10, 2024 19:15
Show Gist options
  • Save cozos/d6636a93cba29c77e3221f2ca30212b0 to your computer and use it in GitHub Desktop.
Save cozos/d6636a93cba29c77e3221f2ca30212b0 to your computer and use it in GitHub Desktop.
import React from 'react';
var ExampleApplication = React.createClass({
render: function() {
var elapsed = Math.round(this.props.elapsed / 100);
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
var message =
'React has been successfully running for ' + seconds + ' seconds.';
return <p>{message}</p>;
}
});
var start = new Date().getTime();
setInterval(function() {
ReactDOM.render(
<ExampleApplication elapsed={new Date().getTime() - start} />,
document.getElementById('container')
);
}, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment