We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'string' of undefined (anonymous function) D:/Java/workspace-neon/suibian-manger-react/src/Counter.js:49 46 | } 47 | 48 | Counter.propTypes = {
49 | caption: PropTypes.string.isRequired, 50 | initValue: PropTypes.number, 51 | onUpdate: PropTypes.func 52 | }; View compiled ▶ 12 stack frames were collapsed.
The text was updated successfully, but these errors were encountered:
自己解决了,附上原因:
在之前的版本之中,我们可以通过React.PropTypes这个API访问React内置的一些类型来检查props,在15.5.0版本中,这一API被独立成了一个新的包 prop-types
// 15.4 以前 import React from 'react'; class Component extends React.Component { render() { return
Sorry, something went wrong.
已解决,谢谢
注意:
自 React v15.5 起,React.PropTypes 已移入另一个包中。请使用 prop-types 库 代替。
No branches or pull requests
TypeError: Cannot read property 'string' of undefined
(anonymous function)
D:/Java/workspace-neon/suibian-manger-react/src/Counter.js:49
46 | }
47 |
48 | Counter.propTypes = {
The text was updated successfully, but these errors were encountered: