Skip to content

Instantly share code, notes, and snippets.

@vyasriday
Created July 28, 2020 06:15
Show Gist options
  • Select an option

  • Save vyasriday/f54c67549d605c165ce8bd104ae16594 to your computer and use it in GitHub Desktop.

Select an option

Save vyasriday/f54c67549d605c165ce8bd104ae16594 to your computer and use it in GitHub Desktop.
code to render list in React
const items = [
{
id: 1,
content: 'This is first Item'
},
{
id: 2,
content: 'This is first Item'
},
{
id: 3,
content: 'This is first Item'
},
{
id: 4,
content: 'This is first Item'
},
]
class ListItems extends React.Component {
constructor(){
}
render() {
return(
<div>
<h3>List Items Code</h3>
{
items.map(item => (
<div key={item.id} className="item-wrapper">
<h4>{item.content}</h4>
</div>
))
}
</div>
)
}
}
export default ListItems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment