Last active
September 17, 2019 11:54
-
-
Save iammdmusa/754993070519a5c0fdd0794d770e4e41 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
Class List extends Component { | |
state = { | |
data : [] | |
} | |
// use this on your API response section only | |
this.setState({ | |
data : response.data // this will be you receiving data in array path | |
}) | |
render() { | |
const { data } = this.state | |
return( | |
<table> | |
<tr> | |
<th>Id</th> | |
<th>Name</th> | |
<th>Mobile</th> | |
<th>Photo</th> | |
</tr> | |
{data && data.map(rowData => ( | |
<tr key={rowData.id}> | |
<td>{rowData.id}</td> | |
<td>{rowData.name}</td> | |
<td>{rowData.mobile}</td> | |
<td>{rowData.photo}</td> | |
</tr> | |
)} | |
</table> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment