Created
July 28, 2020 06:15
-
-
Save vyasriday/f54c67549d605c165ce8bd104ae16594 to your computer and use it in GitHub Desktop.
code to render list in React
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 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