title: How do I clear states or empty array on click in react 0.14 ES6?
body: <p>I am rendering an array in a modal. Once the modal closes I need to empty the array.The following code updates the array but not clear array on click of closeModal. </p>
  
  <pre><code>constructor(props,context) {
     super(props,context);
     this.state = {
        myArray: []
     };
  
   }
  
   pushData(newVar) {
     this.setState((state) =&gt; {
         myArray: state.myArray.push(newVar)
     });
   }
  
   closeModal() {
     this.setState({
         myArray: []
     })
   }
  </code></pre>