I am trying to grab data from firebase and it console logs correctly but array says length is 0

![Code](https://i.stack.imgur.com/N7FEK.jpg)

![Console.log](https://i.stack.imgur.com/mbpAM.jpg)

```js
useEffect(() => {
    let items = [];
    const unsubscribe = store
      .collection('users')
      .doc(user.uid)
      .collection('redirects')
      .onSnapshot(snapShot => {
        snapShot.forEach(getPath => {
          const { path } = getPath.data();
          store.doc(path).onSnapshot(doc => {
            const data = doc.data();
            items.push({ ...data });
          });
        });
      });
    setDocs(items);
    setIsLoading(false);
    return () => unsubscribe();
  }, []);

  console.log(docs);
```