Created
June 27, 2014 06:17
-
-
Save fourcolors/a9f741d077b745e69468 to your computer and use it in GitHub Desktop.
Todo List Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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