From bb4b9fb682b0d1bac90094acbf32795708bcf97e Mon Sep 17 00:00:00 2001 From: Yoseph Ahmed Date: Thu, 20 Aug 2020 15:21:09 -0400 Subject: [PATCH] feat: use of Array.fill in monthlyIncidents useState --- src/incidents/visualize/VisualizeIncidents.tsx | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/incidents/visualize/VisualizeIncidents.tsx b/src/incidents/visualize/VisualizeIncidents.tsx index 9b4d7ef6bd..92718f366d 100644 --- a/src/incidents/visualize/VisualizeIncidents.tsx +++ b/src/incidents/visualize/VisualizeIncidents.tsx @@ -11,21 +11,7 @@ const VisualizeIncidents = () => { const { data, isLoading } = useIncidents(searchRequest) const [incident, setIncident] = useState(0) const [showGraph, setShowGraph] = useState(false) - const [monthlyIncidents, setMonthlyIncidents] = useState([ - // monthlyIncidents[0] -> January ... monthlyIncidents[11] -> December - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ]) + const [monthlyIncidents, setMonthlyIncidents] = useState(Array(12).fill(0)) const getIncidentMonth = (reportedOn: string) => // reportedOn: "2020-08-12T19:53:30.153Z"