我正在使用react-redux来管理我的演示文稿和容器组件 . 我将以下面的方式从我的容器组件向我的演示组件传递一系列操作: -

function mapDispatchToProps(dispatch) {
    return bindActionCreators({ ...ActionList1, ...ActionList2 }, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(PresentationComponent1);

所以我有我的动作文件中指定的动作列表,我将其导入并传递给我的演示组件 . 在我的演示组件中,我根据用户与屏幕的交互触发这些操作 . 对于例如

onRadioButtonChange(event) {
   this.props.changeRadioButtonValue(event.target.value);
}

通过这种方式,我可以从我的演示组件中调用一系列动作 . 现在,我使用Airbnb的eslint配置作为基础 . 现在,其中一条规则是验证道具验证,它失败时会抛出以下错误: -

changeRadioButtonValue is missing in props validation

现在,推荐的解决方法是什么?

  • 为每个动作写出proptypes?有没有办法可以在proptypes验证中指定整个操作文件,而不是单独的操作?

  • 或者在eslint中禁用prop验证?