「已注销」 2017-11-23 08:28 采纳率: 25%
浏览 843
已结题

React编译不通过,在线求解答

在利用npm的create-react-app快速创建一个app时,当访问页面时总是报一个错误,但是这个错误我真是想不明白呀。
图片说明

下面是源码:

import React, {Component} from 'react';

class Counter extends Component (

constructor(props){
    super(props);

    this.onClickIncrementButton = this.onClickIncrementButton.bin(this);
    this.onClickDecrementButton = this.onClickDecrementButton.bin(this);

    this.status = {
        count : props.initValue
    }
}

onClickIncrementButton() {
    this.setState({count : this.state.count + 1});
}

onClickDecrementButton() {
    this.setState({count : this.state.count - 1});
}

render(){
    const {caption} = this.props;
    return (
        <div>
            <button onClick={this.onClickIncrementButton}>+</button>
            <button onClick={this.onClickDecrementButton}>+</button>
            <span>{caption} count : {this.state.count}</span>
        </div>
    );
}

)

Counter.propType = {
caption : PropType.string.isRequired,
initValue : PropType.number
};

Counter.defaultProps = {
initValue : 0
};

export default Counter;

  • 写回答

2条回答 默认 最新

  • 「已注销」 2017-11-23 08:30
    关注

    我试着修改花括号,不管是什么样子的都通不过呀

    评论

报告相同问题?

悬赏问题

  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信