mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 02:12:53 +00:00
27 lines
505 B
JavaScript
27 lines
505 B
JavaScript
import React from 'react';
|
|
import 'whatwg-fetch';
|
|
|
|
export default class SensorList extends React.Component {
|
|
|
|
insertSensorData = (sensor, index) => {
|
|
const date = new Date(sensor.updated);
|
|
|
|
return (
|
|
<div key={index}>
|
|
<h3>{sensor.location}</h3>
|
|
<p>{sensor.temperature}</p>
|
|
<p>{date.toString()}</p>
|
|
</div>
|
|
);
|
|
}
|
|
render() {
|
|
const list = this.props.list;
|
|
|
|
return (
|
|
<div>
|
|
{list.map(this.insertSensorData)}
|
|
</div>
|
|
)
|
|
}
|
|
}
|