title: How can I map specific props to state?
body: <p>I'm trying to map specific props to the <code>brands</code> state. Also, don't add values that already exist in the <code>brands</code> state.</p>
  <p>Goal output:</p>
  <pre><code>brands: [
    &quot;IKEA&quot;,
    &quot;Tesla&quot;
  ]
  </code></pre>
  <p>My attempt</p>
  <pre><code>const mapState = (state) =&gt; ({
    brands: state.products.forEach(product =&gt; {
      if (product.brands) {
        return product.brands;
      }
    })
  });
  
  export default connect(mapState)(Brands);
  </code></pre>
  <p>State:</p>
  <pre><code>products: [
    {
      &quot;id&quot;: 1,
      &quot;title&quot;: &quot;Pen&quot;,
      &quot;brands&quot;: &quot;IKEA&quot;
    },
    {
      &quot;id&quot;: 2,
      &quot;title&quot;: &quot;Flamethrower&quot;,
      &quot;brands&quot;: &quot;Tesla&quot;
    },
    {
      &quot;id&quot;: 3,
      &quot;title&quot;: &quot;T-shirt&quot;,
      &quot;brands&quot;: &quot;Tesla&quot;
    }
  ]
  </code></pre>