Created
December 7, 2016 12:33
-
-
Save jpomykala/48bab72c15302a26e77f1e8774eed20d to your computer and use it in GitHub Desktop.
ReactJS Lists
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
{this.state.places.map(function(place) { | |
return <PlacesListComponent key={place.id} place={place}/>; | |
})} |
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
import React from 'react'; | |
import {Link} from 'react-router'; | |
export default class PlacesListComponent extends React.Component { | |
render() { | |
return ( | |
<div className="row"> | |
<br/> | |
<div className="col-md-7"> | |
<img className="img-responsive" src="http://placehold.it/700x300" alt=""/> | |
</div> | |
<div className="col-md-5"> | |
<h3>{this.props.place.title}</h3> | |
<h4>{this.props.place.city}</h4> | |
<p>{parseInt(this.props.place.distance, 10)}km</p> | |
<Link className="btn btn-primary" to={`/place/${this.props.place.id}`}>View {this.props.place.title}</Link> | |
<span className="glyphicon glyphicon-chevron-right"></span> | |
</div> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment