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