title: Uncaught TypeError: this.delete is not a function
body: <pre><code>import * as React from "react";
  import $ = require("jquery");
  
  
  export class Hello extends React.Component&lt;{}, {}&gt; {
  public delete() {
      console.log("delete");
      $.ajax({
          type: "DELETE",
          url: "http://127.0.0.1:8080/delete",
          xhrFields: {withCredentials: true}
      }).done((data: any): void =&gt; {
          console.log("delete data:" + data);
      }).fail((jqXHR: any): void =&gt; {
          console.log("delete faildata: " + jqXHR.status);
      });
  }
  
  
  public save() {
      console.log("save");
      $.ajax({
          type: "POST",
          url: "http://127.0.0.1:8080/save",
          dataType: "text",
          crossDomain: true,
          xhrFields: {withCredentials: true}
      }).done((data: any): void =&gt; {
          console.log("data:" + data);
          {this.delete()}
      }).fail((jqXHR: any): void =&gt; {
          console.log(jqXHR);
          console.log("faildata: " + jqXHR.status);
      });
  }
  render() {
      return (
          &lt;div&gt;
              &lt;button onClick={this.delete}&gt;delete&lt;/button&gt;
              &lt;button onClick={this.save}&gt;save&lt;/button&gt;
          &lt;/div&gt;
      );
  }
  }
  </code></pre>
  
  <p>update the code, click save ,if the operate done . start to delete data ,
  but now it appears error.<br>
  <a href="https://i.stack.imgur.com/aUMeo.png" rel="nofollow noreferrer">enter image description here</a>
  Hello.tsx:36 Uncaught TypeError: Cannot read property 'delete' of undefined, I have seen the example <a href="https://stackoverflow.com/questions/18618350/typescript-calling-methods-on-class-inside-jquery-function-scope">TypeScript calling methods on class inside jquery function scope</a>, i don't konw why that can run?</p>