Skip to content

Instantly share code, notes, and snippets.

@nayunhwan
Created December 28, 2016 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayunhwan/18d2c2d25963a3dc68ec13dc45a0912d to your computer and use it in GitHub Desktop.
Save nayunhwan/18d2c2d25963a3dc68ec13dc45a0912d to your computer and use it in GitHub Desktop.
React Example TickingClock with Comopnent
function Clock(props) {
return (
<div>
<h1>Hello, world!</h1>
<h2>It is {props.date.toLocaleTimeString()}.</h2>
</div>
);
}
function tick() {
ReactDOM.render(
<Clock date={new Date()} />,
document.getElementById('root')
);
}
setInterval(tick, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment