title: Grouping articles based on category on the same page in Gatsby JS
body: <p>I have a Gatsby JS website and I would like to display on the same page a list of articles grouped by 'families' (categories, basically). </p>
  
  <p>Here's what I did so far: </p>
  
  <pre><code>...
  
  {edges.map(({ node }) =&gt; {
  
                let families = []
                _.each(edges, edge =&gt; {
                    if (_.get(edge, "node.frontmatter.family")) {
                        families = families.concat(node.frontmatter.family)
                    }
                })
  
                _.forEach(family =&gt; {
                    const articlesinfamily = () =&gt; {
                        return edges.filter(edge =&gt; edge.node.frontmatter.family === family)
                    }
  
             return (
                    &lt;&gt;
                    &lt;div className="column is-3"&gt;
                      &lt;div className="content"&gt;
                        &lt;div className="title is-3"&gt;
                            {family}
                        &lt;/div&gt;
                        &lt;p&gt;Description&lt;/p&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div className="column is-9"&gt;
  
                      &lt;div className="columns is-multiline"&gt;
                        {articlesinfamily.map(({ node }) =&gt; {
                          &lt;div className="column is-4"&gt;
                            &lt;div className="content"&gt;
                              &lt;div className="title is-4"&gt;
                                  {node.frontmatter.name}
                              &lt;/div&gt;
                              &lt;p&gt;{node.frontmatter.headline}&lt;/p&gt;     
  
                             &lt;/div&gt;
                           &lt;/div&gt;
                        })}
  
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;/&gt;   
                  )
                })
            })}
  
  
  
  ...
  </code></pre>
  
  <p>This code doesn't work but I think it's the closest I've come to a solution.
  The error I get is </p>
  
  <blockquote>
    <p>Expected an assignment or function call and instead saw an expression</p>
  </blockquote>
  
  <p>on the line where I have {articlesinfamily.map(({ node }) => {....</p>
  
  <p>Any clue on how to make this work? Is there a better way to achieve the desired result?</p>
  
  <p>Thanks a lot.</p>