TypeError: Cannot read property 'string' of undefined
据查从15.5开始 React.PropTypes助手函数已被弃用,改用prop-types 库
import PropTypes from 'prop-types';
class Greeting extends React.Component {
render() {
return (
<h1>Hello, {this.props.name}</h1>
);
}
}
Greeting.propTypes = {
name: PropTypes.string
};
网友评论