title: React set state variable
body: <p>I've an confusion. I'm trying to add array variable in setState. My code is working properly but wanted to confirm some doubt before committing my code.  </p>
  
  <p>Which is right way to store array in state variable ?</p>
  
  <pre><code>var names = ['Jake', 'Jon', 'Thruster'];
  
  this.setState({
      state: names
  });
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>this.setState((state) =&gt; {
      state.items.push(names[0]);
      return state;
  });
  </code></pre>
  
  <p>What is necessary of return statement here ? </p>
  
  <p>Can some one please explain me the difference here ? I searched in google but I'm still confused. </p>