Skip to content

Instantly share code, notes, and snippets.

@fourcolors
Created June 27, 2014 06:17
Show Gist options
  • Save fourcolors/a9f741d077b745e69468 to your computer and use it in GitHub Desktop.
Save fourcolors/a9f741d077b745e69468 to your computer and use it in GitHub Desktop.
Todo List Application
<html>
<head>
<script src="react.js"></script>
<script src="transformer.js"></script>
</head>
<body>
<div id="component"></div>
<script type="text/jsx">
/** @jsx React.DOM */
var ToDoList = React.createClass({
getInitialState: function(){
return {todos: [{completed: false, text: 'go to the store'}, {completed: false, text: 'buy a bike'}]};
},
render: function(){
return (
<div>
<h1>ToDoList</h1>
<ul>
{this.state.todos.forEach(function(todo){
return <li>{todo.text}</li>;
})}
</ul>
</div>
);
}
});
React.renderComponent(<ToDoList />, document.getElementById('component'));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment