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、解决办法