Question about methods in components

Why this code:

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      text: "Hello"
    };
    this.handleClick = this.handleClick.bind(this)
  }
  handleClick() {
    this.setState({
      text: "You clicked!"
    });
  }

And not

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      text: "Hello"
    };
    this.handleClick = handleClick() { // Is 'this' refering to the constructor?
    this.setState({  // also is 'this' here refering to the constructor?
      text: "You clicked!"
    });
  }
  }
  

Thanks,

Andrej

Ok but why not define the handelClick in the constructor??

But you are using handelClick to change the state. Why not just put that method in the constructor. What would happen? Compared to putting it outside the constructor and making it a method of class…