title: ReactJS can't set state from an event with event.persist()
body: <p>I need to set a state field which I get from an event, but it doesn't get set when I pass a function to it. The component and method looks like the following:</p>
  
  <pre><code>constructor(props: SomeProps, context: any) {
    super(props, context);
    this.state = {
      isFiltering: props.isFiltering,
      anchor: "",
    };
  }
  
  private toggleFilter = (event: any) =&gt; {
    event.persist()
    this.setState(prevState =&gt; ({
      isFiltering: !prevState.isFiltering,
      anchor: event.currentTarget // does not work, it's null
    }));
  }
  </code></pre>
  
  <p>If I remove <code>event.persist()</code> then I get the following error :</p>
  
  <blockquote>
    <p>This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the method <code>currentTarget</code> on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See <a href="https://facebook.github.io/react/docs/events.html#event-pooling" rel="noreferrer">https://facebook.github.io/react/docs/events.html#event-pooling</a> for more information.</p>
  </blockquote>
  
  <p>For some reason the following code works:</p>
  
  <pre><code>private toggleFilter = (event: any) =&gt; {
    this.setState({anchor:event.currentTarget}) // works fine
    this.setState(prevState =&gt; ({
      isFiltering: !prevState.isFiltering,
    }));
  }
  </code></pre>
  
  <p>Why does the above works but not when I use <code>this.setState(prevState=&gt; ...)</code>?</p>