title: ReactJS handleClick triggers without clicking when the page loads
body: <p>React newbie here. I just want a simple button that does something on click. But the handleClick function gets triggered when the page loads. </p>
  
  <p>I've found this <a href="https://stackoverflow.com/questions/39705916/reactjs-mouseclick-gets-triggered-without-a-click">ReactJS - MouseClick gets triggered without a click</a>, but is there really no other way to make it work without creating an extra class?</p>
  
  <p>This is my code:</p>
  
  <pre><code>class Login extends Component {
      constructor(props, context) {
          super(props, context);
  
          this.state = {
              open: false,
          };
  
          this.handleClick = this.handleClick.bind(this);
      }
  
      handleClick(){
          console.log('The link was clicked.');
          history.push("/zeitsammler/homepage");
      }
  
      render() {
         return (
              &lt;MuiThemeProvider muiTheme={muiTheme}&gt;
                  &lt;div style={styles.container}&gt;
                      &lt;RaisedButton label="Login" style={btnStyle} onClick={this.handleClick()} /&gt;
                  &lt;/div&gt;
              &lt;/MuiThemeProvider&gt;
          );
      }
  }
  </code></pre>