1、React在ES6的实现中去掉了getInitialState这个hook函数,规定state在constructor中实现,如下:原文链接:https://www.f2er.com/react/305099.htmlClass App extends React.Component { constructor(props) { super(props); this.state = {}; } }
1、React在ES6的实现中去掉了getInitialState这个hook函数,规定state在constructor中实现,如下:原文链接:https://www.f2er.com/react/305099.htmlClass App extends React.Component { constructor(props) { super(props); this.state = {}; } }