setState from within setInterval function prevents Sketch rendering
👋 Hello! Thanks for contributing. Please use the template that matches your intention  

_I am calling this.setState from within a setInterval handler and Sketch does not render updated code, only refreshes previous_

```
// simplified example
class Clock extends React.Component {
  componentWillMount() {
    this.setState({
      time: new Date(),
      timer: setInterval(() => {
        this.setState({ time: new Date() }) // FAILS
      }, 1000)
    })
  }
  render() {
    return (
      <Text>{this.state.time.toLocaleString('en-US')}</Text>
    )
  }
}
```

| -------------------------------------------------------------------------------------------------
| Reporting a bug or issue
| -------------------------------------------------------------------------------------------------

**Expected behavior:**

I don't expect Sketch to keep updating the clock value, it can just show the initial value.  However, in reactjs/native code I do want the ```time``` value to be updated every second.

**Observed behavior:**

The line marked ```FAILS``` generates a error, ```undefined is not an object when evaluating this.setState```.  NB: It's the inner call that fails, within the interval handler.  it appears ```this``` is undefined at this point.

The plugin DOES get refreshed when skpm builds, but all it does is refresh the page, which updates the clock value but does not reflect any other code changes (because its working from a version which first introduced the evaluation error).

The only way to get Sketch to properly evaluate updated code (even code removing the erroneous line) is to close the current document without saving, Quit Sketch and reload, opening a new document.

The bug effectively disables Sketch's ability to receive updated code from the plugin.

**How to reproduce:**

As above.

**Sketch version:**

48.2

**I appreciate this is probably more a failing in Sketch or SKPM, but wanted to introduce the context where it occurs.**

The code above works when included in a ReactJS (web) or React Native application, and its a bit unclear why it fails in the way it does in React Sketchapp (```setInterval``` does exist, and works as expected in sketchapp, as long as ```this``` is not referenced NB: Yes, I did try ```const self=this``` and referencing ```self```)