import React from "react"; import Card from "./Card"; import GoatCounter from "./GoatCounter"; const MainPage = (props) => { const data = props.data; const latest = data[data.length - 1]; const prior = data[data.length - (1 + props.timeDifference)]; const priorPrior = data[data.length - (1 + props.timeDifference * 2)]; const positiveTestRate = ( ((latest.total_students - prior.total_students) * 100) / (latest.tests_administered - prior.tests_administered) ).toFixed(1); const priorPositiveTestRate = ( ((prior.total_students - priorPrior.total_students) * 100) / (prior.tests_administered - priorPrior.tests_administered) ).toFixed(1); return ( <>