title: Why doesn't this filter update the state?
body: <p>I'm working with Firebase to retrieve data from the firestore, where I want to grab two groups of information, one would contain the &quot;active&quot; events, which the enddate is after the current date, and the &quot;expired&quot; dates, which enddates are before our current date.
  (My dates are stored as M/D/YYYY, ex: 6/7/2022</p>
  <p>Variables I'm using:</p>
  <pre><code>const [events, setEvents] = useState([]);
  const [expEvents, setExpEvents] = useState([]);
  const today = new Date().toLocaleDateString();
  </code></pre>
  <p>My UseEffect:</p>
  <pre><code>    useEffect(() =&gt; {
          console.log(&quot;Fetching Events..&quot;)
          console.log(today)
          setLoading(true)
          const getEvents = async () =&gt; {
              const data = await getDocs(eventsRef);
              setEvents(data.docs.map((event) =&gt; ({...event.data()})))
              setExpEvents(data.docs.map((event) =&gt; ({...event.data()})))
          }
          getEvents()
          setExpEvents(expEvents.filter(event =&gt; Date.parse(event.enddate) &lt; Date.parse(today)))
          console.log(&quot;Fetched Events!&quot;)
          setLoading(false) //done 
          console.log(events)
      }, [])
  </code></pre>
  <p>The issue I'm having is that it seems this filter statement is either incorrect, or getting overrided with something else, but I can't seem to understand why. Any help is appreciated.</p>