显然,我需要删除ESLint中的警告
'campaignTypesResult' is missing in props validation react/prop-types
'campaignTypesResult.map' is missing in props validation react/prop-types
'statusesResult' is missing in props validation react/prop-types
'statusesResult.map' is missing in props validation react/prop-types
'campaignsActions' is missing in props validation react/prop-types
'campaignsActions.createCampaign' is missing in props validation react/prop-types
campaignTypesResult
和statusesResult
是在react-redux中初始化的数组。
campaignsActions
是react-redux中广告系列的操作。
我认为campaignTypesResult
是propType.array
和campaignsActions
propType.function
。
每种方法的正确验证是什么?
答案 0 :(得分:0)
知道了,似乎动作是一个'对象',我的初始状态是'数组'。将操作作为“函数”在控制台中写入错误,指出操作确实是“对象”。
AddCampaignPage.propTypes = {
statusesActions: PropTypes.object,
campaignTypesActions: PropTypes.object,
campaignsActions: PropTypes.object,
campaignTypesResult: PropTypes.array,
statusesResult: PropTypes.array
};