The component appe

2020-11-06  本文已影响0人  米古月_f198

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',
}
}

上一篇 下一篇

猜你喜欢

热点阅读