React
by aparadise
HTML
<div id="app"></div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
React
class TodoApp extends React.Component {
constructor(props) {
super(props)
this.state = {
items: [
{ id: 1, text: "Learn JavaScript"},
{ id: 21, text: "Learn React" },
{ id: 31, text: "Play around in JSFiddle" },
{ id: 17, text: "Build something awesome" }
]
}
this.myItems = this.state.items.map((item, i) =>
<p className={i} key={item.id}>{item.text}</p>
);
}
render() {
return (
<div>
{this.myItems}
</div>
)
}
}
ReactDOM.render(<TodoApp />, document.querySelector("#app"))