title: React redux how to use getState()
body: <p>I am fetching data from the <code>Firebase Real-time database</code> and storing it into my redux state. How can I create an action that will get the latest and most up to date state after the initial call?</p>
  <pre><code>const getIds = (state) =&gt; state.notes.activeNotes;
  
  export const getUserNotes = (currentUserId) =&gt; (dispatch, getState) =&gt; {
    getFromFirebase(`/Notes/${currentUserId}/`, (response) =&gt; {
      var ids = Object.keys(response)
        dispatch(setNoteIds(ids)); //should dispatch ids something like this [1,2,3,4,5]
    })
  
    const test= getIds(getState());
    console.log(test); //current output []
  }
  
  Expected output: [1,2,3,4,5]
  Actual output: []
  </code></pre>