我prop-types
通过运行安装了软件包npm i prop-types --save
,我的依赖项是:
"dependencies": {
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
我的代码:
import React from 'react';
import PropTypes from 'prop-types';
function Question(props) {
return (
<h2 className="question">{props.content}</h2>
);
}
Question.propTypes = {
content: React.PropTypes.string.isRequired
};
export default Question;
我在这里错过了什么?