美文网首页
The component appe

The component appe

作者: 米古月_f198 | 来源:发表于2020-11-06 09:28 被阅读0次

react-hot-loader引起报错问题
The <HeadTable /> component appears to be a function component that returns a class instance. Change HeadTable to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. HeadTable.prototype = React.Component.prototype. Don't use an arrow function since it cannot be called with new by React.

安装
npm install @hot-loader/react-dom@16 --save

配置项里 加上 'react-dom': '@hot-loader/react-dom', 如下最后一行

resolve: {
extensions: ['.js'],
alias: {
actions: ${srcPath}/actions/,
addons: ${srcPath}/addons/,
components: ${srcPath}/components/,
constants: ${srcPath}/constants/,
containers: ${srcPath}/containers/,
source: ${srcPath}/source/,
stores: ${srcPath}/stores/,
styles: ${srcPath}/styles/,
reducers: ${srcPath}/reducers/,
config: ${srcPath}/config/ + process.env.REACT_WEBPACK_ENV,
'react-dom': '@hot-loader/react-dom',
}
}

相关文章

网友评论

      本文标题:The component appe

      本文链接:https://www.haomeiwen.com/subject/eunzvktx.html