Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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')
- );
Add Comment
Please, Sign In to add comment