import React from 'react';
import PropTypes from 'prop-types';

//destructure props
export default function List({entities}){
    return (
	<>
	    <h2>List</h2>
	    <h3>Entity List</h3>
	    <table>
		<thead>
		    <tr>
			<th>entity id</th>
			<th>entity name</th>
			<th>entity lat</th>
			<th>entity lon</th>
		    </tr>
		</thead>
		<tbody>
		    {entities.map((item,key) => {
			return(
			    <tr
				key={key}
			    >
				<td>{item[0]}</td>
				<td>{item[1]}</td>
				<td>{item[2]}</td>
				<td>{item[3]}</td>
			    </tr>
			)})}
		</tbody>
	    </table>
	</>
    );
}
List.propTypes = {
    entities: PropTypes.array,
};
