useEffect에서 Firestore 데이터 가져오기를 정리하는 방법은 무엇인가요?
                                            
                                                
                                                
                                                
                                                
                                                
                                                 3080 단어  reactjavascripthelp
                    
다음은 콘솔의 오류입니다.

내가 사용하고 있는 useEffect 후크의 코드는 다음과 같습니다.
useEffect(() => {
    const fetchDb = db.collection('posts');
    fetchDb.get()
      .then(response => {
        const fetchedPosts = [];
        response.docs.forEach(post => {
          const fetchedPost = {
            id: post.id,
            ...post.data()
          };
          fetchedPosts.push(fetchedPost);
        });
        setPosts(fetchedPosts);
        setIsLoading(false);
      })
      .catch(error => {
        error = 'Houve um erro'
        setError(error);
      });
  }, []);
                Reference
이 문제에 관하여(useEffect에서 Firestore 데이터 가져오기를 정리하는 방법은 무엇인가요?), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/rnrnshn/how-to-cleanup-firestore-data-fetch-on-useeffect-18ed텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)