Skip to content

Instantly share code, notes, and snippets.

@basekays
Created June 20, 2018 22:46
Show Gist options
  • Select an option

  • Save basekays/d8a48e1fe9f21cbe8cfd25fd2dc0619d to your computer and use it in GitHub Desktop.

Select an option

Save basekays/d8a48e1fe9f21cbe8cfd25fd2dc0619d to your computer and use it in GitHub Desktop.
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