Created
June 20, 2018 22:46
-
-
Save basekays/d8a48e1fe9f21cbe8cfd25fd2dc0619d 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
| const homeList = [ | |
| { | |
| id: '1', | |
| name: 'a', | |
| address: 'aaaaa', | |
| photo: 'A', | |
| description: 'AAA', | |
| }, | |
| { | |
| id: '2', | |
| name: 'b', | |
| address: 'bbbbb', | |
| photo: 'B', | |
| description: 'BBB', | |
| }, | |
| { | |
| id: '3', | |
| name: 'c', | |
| address: 'ccccc', | |
| photo: 'C', | |
| description: 'CCC', | |
| }, | |
| ]; | |
| class HomeList extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| <h3>HomeList</h3> | |
| <HomeListItem items={homeList} /> | |
| </div> | |
| ); | |
| } | |
| } | |
| class HomeListItem extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| {this.props.items.map((item) => ( | |
| <div key={item.id}> | |
| <h3>{item.name}</h3> | |
| <div>Address: {item.address}</div> | |
| <div>Photo: {item.photo}</div> | |
| <div>Description: {item.description}</div> | |
| <div>---------------------</div> | |
| </div> | |
| ))} | |
| </div> | |
| ); | |
| } | |
| } | |
| ReactDOM.render( | |
| <HomeList />, | |
| document.getElementById('root') | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment