Forked from caoakleyii/gist:ee1916cc3bbec33b9807bac129c9fa36
Last active
March 29, 2016 20:37
-
-
Save JosephShering/add3668dfe84712651e36df7a96c46a4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import React, { Component } from 'react'; | |
import Party from './Party.jsx'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
parties: [] | |
}; | |
} | |
componentWillMount() { | |
//Ajax like a beast | |
myajax.get('/parties', parties => this.setState({ parties })); | |
} | |
mapParties(party, index) { | |
return ( | |
<li key={index}> | |
{party.name} | |
</li> | |
); | |
} | |
render() { | |
const {parties} = this.state; | |
return( | |
<div className="container"> | |
<header> | |
<h1>Todo List</h1> | |
</header> | |
<ul> | |
{parties.map(this.mapParties.bind(this))} | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment