Membalikkan skrip java array
import React, { Component } from 'react';
export default class Slideshows extends Component {
constructor(){
super();
this.state = {
data:[
{ "id": "1", "name": 'Robert', "age": "21" },
{ "id": "2", "name": 'Sam', "age": "33" },
{ "id": "3", "name": 'Jerry', "age": "42" },
]
}
}
render() {
const reverseData = this.state.map((data, i) => {
return (
<li> {data.name} | {data.age} </li>
)
})
return (
<ul>
{reverseData}
</ul>
)
}
}
Dizzy Duck