在组件中:
import PropTypes from ‘prop-types‘;
{ items, onModifyItem, onDeleteItem }
这是传入的值
PriceList.propTypes = {
items: PropTypes.array.isRequired,
onModifyItem: PropTypes.func.isRequired,
onDeleteItem: PropTypes.func.isRequired,
}
原文:https://www.cnblogs.com/JustSearchIt/p/14375494.html