TypeError: react__WEBPACK_IMPORTED_MODULE_0___default.a.createClass is not a function


1、错误描述

2、错误原因

import React, {Component} from 'react';
import {render} from 'react-dom';
import Button from 'react-bootstrap/Button';

var TickTock = React.createClass({
    mixins: [SetIntervalMixin], 
    getInitialState: function() {
        return {seconds: 0};
    },
    componentDidMount: function() {
        this.setInterval(this.tick, 2000); 
    },
    tick: function() {
        this.setState({seconds: this.state.seconds + 1});
    },
    render: function() {
        return (
            <label>
                {this.state.seconds} seconds.
            </label>
        );
    }
});

     由错误提示可知,是React.createClass不是一个函数(方法)

3、解决办法


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM