title: Lookup multiple Firebase entries using Redux action
body: <p>I have this Redux action, which looks up a user and returns all the items they have:</p>
  
  <pre><code>export const itemsFetch = () =&gt; {
    const { currentUser } = firebase.auth();
    return dispatch =&gt; {
      firebase
        .database()
        .ref(`users/${currentUser.uid}/items`)
        .on('value', snapshot =&gt; {
          dispatch({ type: ITEMS_FETCH_SUCCESS, payload: snapshot.val() });
        });
    };
  };
  </code></pre>
  
  <p>Works great, and each item returned has a unique key associated with it.</p>
  
  <p>I want to modify this action to look up <strong>specific items</strong>, which I've done. That works fine too:</p>
  
  <pre><code>export const itemLookup = uid =&gt; {
    const { currentUser } = firebase.auth();
    return dispatch =&gt; {
      firebase
        .database()
        .ref(`users/${currentUser.uid}/items/${uid}`)
        .on('value', snapshot =&gt; {
          dispatch({ type: ITEM_LOOKUP_SUCCESS, payload: snapshot.val() });
        });
    };
  };
  </code></pre>
  
  <p>This also works fine, but I can only use this to lookup a single item. </p>
  
  <p>I want to loop over an array of item ids, and lookup details for each. Doing this from a component, and using <code>mapStateToProps</code>, causes the component to rerender each time, losing the previous lookup in the process.</p>
  
  <p>Is it best to loop over the ids I have at a component level, and make multiple calls. Or should I pass the array to the action, and somehow loop over them within the action?</p>
  
  <p>Thanks</p>
  
  <p>I feel like I'm doing something dumb, or misunderstanding Redux completely. </p>