Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).
package.json
"dependencies": {
"antd-mobile": "^0.8.5",
"es6-promise": "^4.0.2",
"extract-text-webpack-plugin": "^1.0.1",
"html-withimg-loader": "^0.1.16",
"isomorphic-fetch": "^2.2.1",
"react": "^15.3.2",
"react-dom": "^15.3.2"
}
webpack.config.js
externals: {
'react-dom' : 'ReactDOM'
},
index.html中引入 外部reactdom
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
<title><%= htmlWebpackPlugin.options.title %></title>
<script src="https://npmcdn.com/react-dom@15.3.1/dist/react-dom.js"></script>
</head>
<body>
</body>
</html>
如果不使用外部依赖的话 没有错误的
我也遇到同问,楼主解决了吗?