title: Cannot assign to 'state' because it is a constant or a read-only property
body: <p>When I do a search on this issue, I can only find questions that modify <code>this.state</code> directly somewhere in a method body instead of using <code>this.setState()</code>. My problem is that I want to set a starting state in the constructor as follows:</p>
  
  <pre><code>export default class Square extends React.Component&lt;any, any&gt; {
    constructor(props: any) {
      super(props);
      this.state = {
        active: false
      };
    }
  
    public render() {
      ...
    }
  }
  </code></pre>
  
  <p>The app fails to start with the following compile error: </p>
  
  <pre><code>Cannot assign to 'state' because it is a constant or a read-only property
  </code></pre>
  
  <p>And this is because in definition of <code>React.Component</code> we have: </p>
  
  <pre><code>readonly state: null | Readonly&lt;S&gt;;
  </code></pre>
  
  <p>So I'm not sure how to go about this. The official react tutorial in JS directly assigns to <code>this.state</code> and says that it is an acceptable pattern to do so in the constructor, but I can't figure out how to do this with TypeScript.</p>