title: Best place/way to declare static data in React
body: <p>I am reading through the internet trying to find some performance resolute or preferred method of declaring static data, variables in react so I would like to hear your opinion.</p>
  
  <p>This goes for react stateless and class components.</p>
  
  <p>Let’s say I have an array with colors that I want to use somewhere inside React <code>return()</code>.</p>
  
  <pre><code>const colors = ["red, "green", "blue"];
  </code></pre>
  
  <p>1) Declare it inside of <code>render()</code></p>
  
  <p>I suppose this is not preferred, snce it will be recreated on every render.</p>
  
  <p>2) Declare it in constructor as a global variable</p>
  
  <pre><code>this.colors = ["red, "green", "blue"];
  </code></pre>
  
  <p>Nice, but maybe not preferred in some cases to have global variables.</p>
  
  <p>3) Declare it as a return of function placed inside React component but outside of <code>render()</code>. We call the function from React <code>return()</code></p>
  
  <p>4) I think I saw somewhere using defaultProps.</p>
  
  <p>Is there a best practice?</p>