Created
June 27, 2014 21:07
-
-
Save fourcolors/6f3429ab57d299291279 to your computer and use it in GitHub Desktop.
ToDoList ReactJS
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
<!DOCTYPE html> | |
<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.map(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