我正在从docs学习 react ,但不确定super()这个例子中的作用。通常情况下,不是将传入的参数用于创建新实例,然后调用 React.Component 的构造函数方法将这些参数合并到实例中吗?没有任何参数它会做什么?
class LikeButton extends React.Component {
  constructor() {
    super();
    this.state = {
      liked: false
    };
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    this.setState({liked: !this.state.liked});
  }
  render() {
    const text = this.state.liked ? 'liked' : 'haven\'t liked';
    return (
      <div onClick={this.handleClick}>
        You {text} this. Click to toggle.
      </div>
    );
  }
}
ReactDOM.render(
  <LikeButton />,
  document.getElementById('example')
);