title: Firestore getDoc() not saving on useState() hook in reactjs
body: <p>I'm trying to get a doc value from firebase using the getDoc() method. It's working. But can't save on useState() hook in ReactJS</p>
  <p>Here is my code:</p>
  <pre><code>const [post, setPost] = React.useState(null);
  
      React.useEffect(() =&gt; {
          const fetchPost = async () =&gt; {
              const docSnap = await getDoc(doc(db, &quot;posts&quot;, id));
              setPost(docSnap.data())
          }
  
          return () =&gt; fetchPost();
      }, []);
  </code></pre>