相关的行在bundle.js中:
exports["default"] = _react.PropTypes.shape({
subscribe: _react.PropTypes.func.isRequired,
dispatch: _react.PropTypes.func.isRequired,
getState: _react.PropTypes.func.isRequired
});
我刚升级到React 16,并按照此tutorial调整PropTypes。我只有一个引用prop类型的组件,如下所示:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
export default function (ComposedComponent) {
class Authentication extends Component {
static contextTypes = {
router: PropTypes.object
}
我在这里做错了什么?
编辑:这是我的依赖项:
"devDependencies": {
"chai": "^3.5.0",
"chai-jquery": "^2.0.0",
"css-loader": "^0.28.7",
"ignore-styles": "^5.0.1",
"jquery": "^2.2.1",
"jsdom": "^8.1.0",
"loaders": "^1.1.3",
"mocha": "^2.4.5",
"node-sass": "^4.5.3",
"prop-types": "^15.6.0",
"react-addons-test-utils": "^0.14.7",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"axios": "^0.16.2",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.1.18",
"lodash": "^3.10.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-spinkit": "^3.0.0",
"redux": "^3.0.4",
"redux-form": "^7.0.4",
"redux-thunk": "^2.2.0",
"webpack": "^3.8.1"
}
编辑2:即使我注释掉这一行,也会出现同样的错误。但是这条线是整个项目中唯一提到道具类型的地方。是什么给了什么?
static contextTypes = {
router: PropTypes.object
}
答案 0 :(得分:2)
当前版本的react-spinkit
还没有为React 16.0做好准备,因为它仍然使用现在不受支持的React.PropTypes
:
最后一次提交是在5月22日。我担心你现在无法升级React。但看起来当前代码已经是两者的混合,并且只有一行可以更改,因此您可以向他们提交带有该更改的拉取请求。