diff options
author | Galen Guyer <galen@galenguyer.com> | 2020-11-16 19:03:26 -0500 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2020-11-16 19:03:26 -0500 |
commit | 0f124e66f23d8925af91d574740f8513dd343dd6 (patch) | |
tree | 441b1e134c323b29621f030bda19dd345cad33df /src | |
parent | a4fa00b052cb7d618125983efc626d2af62f9919 (diff) |
Move data into MainPage
Diffstat (limited to 'src')
-rw-r--r-- | src/App.js | 2 | ||||
-rw-r--r-- | src/MainPage.js | 5 |
2 files changed, 4 insertions, 3 deletions
@@ -70,7 +70,7 @@ function App() { <br /> <Switch> <Route exact path="/"> - <MainPage latest={latest} prior={prior} />{" "} + <MainPage data={data} timeDifference={timeDifference} /> </Route> <Route path="/totalstudents"> <History diff --git a/src/MainPage.js b/src/MainPage.js index 7c316c4..7dd0cc9 100644 --- a/src/MainPage.js +++ b/src/MainPage.js @@ -3,8 +3,9 @@ import Card from "./Card"; import GoatCounter from "./GoatCounter"; const MainPage = (props) => { - const latest = props.latest; - const prior = props.prior; + const data = props.data; + const latest = data[data.length - 1]; + const prior = data[data.length - (1 + props.timeDifference)]; return ( <> |