1、React在ES6的实现中去掉了getInitialState这个hook函数,规定state在constructor中实现,如下:Class App extends React.Component { constructor(props) { super(props); this.state = {}; } }
1、React在ES6的实现中去掉了getInitialState这个hook函数,规定state在constructor中实现,如下:Class App extends React.Component { constructor(props) { super(props); this.state = {}; } }