gompass/src/components/map.jsx

28 lines
571 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import EntitiesMap from './map/map-entities';
/*destructure props object*/
export default function Map ({array, title}){
if ( array !== undefined && array !== null && array.length > 0 ) {
/*return a React element*/
return (
<>
<p>Map of {array.length}&nbsp;{title}</p>
<EntitiesMap entities={array} />
</>
);
}else{
return (
<>
<p>Loading...</p>
</>
);
}
};
Map.propTypes = {
array: PropTypes.array,
title: PropTypes.string
};