title: Initialize an array in React component render (in terms of performance)
body: <p>It is known that we should not use anonymous functions in render because they will be re-create on each render. But what about an array of objects like this:</p>
  
  <pre><code>// name props is passed in so it seems like there is a point in initializing the array inside the component
  const Component = ({ name }) =&gt; {
    // let's imagine there is a lot of large objects
    const bigArray = [{id: 1, name}, {id: 2, name}];
  
    return &lt;AnotherComponent data={bigArray} /&gt;;
  }
  </code></pre>
  
  <p>I suppose that arrays (and objects inside) are stored by reference so when the component is re-rendered, the interpreter sees that this is the same reference and won't re-create the array. Is my assumption correct?</p>