Skip to content

Instantly share code, notes, and snippets.

@leofrozenyogurt
Created March 21, 2016 20:45
Show Gist options
  • Save leofrozenyogurt/1f306e48bdec9179825e to your computer and use it in GitHub Desktop.
Save leofrozenyogurt/1f306e48bdec9179825e to your computer and use it in GitHub Desktop.
var AgencyInfo = React.createClass({
componentWillMount(){
this.getAgencyInfo();
},
getAgencyInfo(event){
$.ajax({
url: "agencies/"+this.props.id+".json",
dataType: 'json',
success: function(data) {
this.setState({rendered_categories: data});
}.bind(this),
error: function(data) {
this.setState({rendered_categories: []});
}.bind(this)
});
console.log("happened");
},
render () {
var categories = (category) => <CategoryInfo title={category.title} currently={category.id} forward={category.id} />
return (
<div className="col-sm-6 agency-left-header">
<img className="agency-logo img-responsive" src="http://placehold.it/300x300" />
<h1>{this.props.name}</h1>
{this.state.rendered_categories.map(categories)}
</div>
)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment