title: Type 'void' is not assignable to type '((event: MouseEvent<HTMLInputElement>) => void) | undefined'
body: <pre><code>   import * as React from "react";
     import "./App.css";
     import PageTwo from "./components/PageTwo";
  
      export interface IPropsk {
          data?: Array&lt;Items&gt;;
          fetchData?(value: string): void;
      }
  
      export interface IState {
         isLoaded: boolean;
         hits: Array&lt;Items&gt;;
         value: string;
      }
      class App extends React.Component&lt;IPropsk, IState&gt; {
          constructor(props: IPropsk) {
          super(props);
  
          this.state = {
          isLoaded: false,
          hits: [],
          value: ""
          this.handleChange = this.handleChange.bind(this);
    }   
  
    fetchData = val =&gt; {
          alert(val);
    };
  
    handleChange(event) {
         this.setState({ value: event.target.value });
    }
  
  
    render() {
     return (
        &lt;div&gt;
          &lt;div&gt;
             &lt;input type="text" value={this.state.value} onChange= {this.handleChange}
             &lt;input type="button" onClick={this.fetchData("dfd")} value="Search" /&gt;
        &lt;/div&gt;
       &lt;/div&gt; 
  
      );
  
    }
  }
  
   export default App;
  </code></pre>
  
  <p>In the above code example I tried to call a method(<strong>fetchData</strong> ) by clicking button with a paremeter.But I gives a error from following line</p>
  
  <pre><code> &lt;input type="button" onClick={this.fetchData("dfd")} value="Search" /&gt;
  </code></pre>
  
  <p>The error is</p>
  
  <p></p>
  
  <p><em>type 'void' is not assignable to type '((event: MouseEvent) => void) | undefined'.</em></p>