title: What is the difference between using () or {} after the arrow in an arrow function?
body: <p>I usually always write an arrow function and when I need it to be multi-lined then I do &quot;{}&quot;. However, I am watching a tutorial, and in it, he is writing this useEffect function:</p>
  <pre><code>  useEffect(() =&gt; {
      if (chatId) {
        db.collection(&quot;chats&quot;)
          .doc(chatId)
          .collection(&quot;messages&quot;)
          .orderBy(&quot;timestamp&quot;, &quot;desc&quot;)
          .onSnapshot(snapshot =&gt; (
            setMessages(snapshot.docs.map(doc=&gt;({
              id:doc.id,
              data:doc.data()
            })))
          ));
      }
    }, []);
  </code></pre>
  <p>notice after &quot;snapshot&quot; he has &quot;=&gt; (&quot; not &quot;=&gt; {&quot; and also snapshot.docs.map(doc=&gt;({ where there is a &quot;({&quot; rather than just a &quot;{&quot;. Someone help me understand what I am missing here?</p>