Create react app 使“安静”;您正在手动调用React.PropTypes“;
我使用的是最新的react,我有一个自定义验证函数,如下所示:Create react app 使“安静”;您正在手动调用React.PropTypes“;,create-react-app,Create React App,我使用的是最新的react,我有一个自定义验证函数,如下所示: editing: function(props, propName, componentName) { /* { [password/displayname/email]: { form: object destroying: bool }
editing: function(props, propName, componentName) {
/*
{
[password/displayname/email]: {
form: object
destroying: bool
}
}
*/
let prop = props[propName];
if (prop === undefined) return; // is not isRequired
let failobject = PropTypes.object({ [propName]:prop }, propName, componentName);
if (failobject) return failobject;
for (let [key, val] of Object.entries(prop)) {
let failkey = PropTypes.oneOf(['password', 'displayname', 'email'])({ key:key }, 'key', componentName);
if (failkey) return failkey;
let failshape = PropTypes.shape({
form: PropTypes.object, // not required, as initially undefined
destroying: PropTypes.bool // not required, as i only set this to true when it starts to transition out
})({ value:val }, 'value', componentName);
if (failshape) return failshape;
}
}
}).isRequired,
我只打算在开发中使用它。React一直对我大喊大叫,警告我:
“警告:您正在手动调用React.PropTypes验证
用于车身轮廓
上的键
道具的功能。此功能已被弃用,并且
将无法在下一个主要版本的生产环境中工作。您可能
由于第三方PropTypes库而看到此警告。请参阅
fb.me/react-warning-dont-call-proptypes了解详细信息。”
bundle.js:11902:10
我正在使用CreateReact应用程序-是否有必要告诉它我正在开发中,而不是告诉我此弃用警告