Created
June 27, 2014 06:43
-
-
Save fourcolors/16d541ac913a22e9da69 to your computer and use it in GitHub Desktop.
ReactJS Breaking with No Div
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 ( | |
<h1>ToDoList</h1> | |
<ul> | |
{this.state.todos.map(function(todo){ | |
return <li>{todo.text}</li>; | |
})} | |
</ul> | |
); | |
} | |
}); | |
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