标签:hello default nal ati 字符串 imp 字符串类型 出现 官网
https://www.npmjs.com/package/prop-types npm官网
https://reactjs.org/docs/typechecking-with-proptypes.html react官方
//安装
npm install prop-types --save
//引入
import PropTypes from ‘prop-types‘;
static propTypes={
name:PropTypes.string.isRequired
}
TodoItem.propTypes = {
test:Proptypes.string.isRequired,
item : Proptypes.string,
deleteItem: Proptypes.func,
index : Proptypes.number
}
TodoItem.defaultProps = {
test:‘hello‘
}
标签:hello default nal ati 字符串 imp 字符串类型 出现 官网
原文地址:https://www.cnblogs.com/zhx119/p/11022426.html