title: React: passing state value as parameter to method
body: <p>I want to make my class more reusable. I have huge form to handle, and I don't want write single method for each input. How to pass state value as parameter to method?</p>
  
  <p>I was trying:</p>
  
  <pre><code>  state = {
      subtitle: ""
    };
  
  
    inputHandler = (e, param) =&gt; this.setState({ [param]: e.target.value });
  
    render() {
      return (
        &lt;&gt;
          {this.state.title}
          &lt;input
            type="text"
            value={this.state.subtitle}
            onChange={e =&gt; this.inputHandler(this.state.subtitle)}
          /&gt;
        &lt;/&gt;
      );
    } 
  </code></pre>
  
  <p>and different similar combinations of this solution.</p>
  
  <p>Demo: <a href="https://codesandbox.io/s/kw6pnxwv0v" rel="nofollow noreferrer">https://codesandbox.io/s/kw6pnxwv0v</a></p>