title: How can I mapped through this object from firestore?
body: <p>Getting the users collection from firestore:</p>
  <pre><code>  useEffect(() =&gt; {
          if (currentUser) {
            const unsubscribe = db
              .collection(&quot;users&quot;)
              .doc(uid)
              .onSnapshot((snapshot) =&gt; {
            const arr = [];
            arr.push({
              ...snapshot.data(),
            });
  
            setUsers(arr);
            console.log(JSON.stringify(arr));
          });
  
        return () =&gt; {
          unsubscribe();
        };
      }
    }, [currentUser]);
  </code></pre>
  <p>This is what is shows where I <code>console.log(JSON.stringify(arr));</code></p>
  <pre><code>[
    {
      1: { others: &quot;books&quot;, items: { Item1: true, Item2: true } },
      2: {
        items: { Item3: true, Item2: true },
        others: &quot;books&quot;,
      },
  
      displayName: Inigi,
      address: &quot;US&quot;,
    },
  ];
  </code></pre>
  <p>I am new to react so this is quite confusing to me. How do I retrieve and display those <code>1</code> and <code>2</code>?</p>
  <p>I tried this but it does not work and I keep on getting an error:&quot;</p>
  <blockquote>
  <p>TypeError: _user$.items.map is not a function</p>
  </blockquote>
  <pre><code> {user[&quot;1&quot;]?.items.map((index) =&gt; (
                    &lt;li&gt;{index.Item1}&lt;/li&gt;
                  ))}
  </code></pre>