Reactjs 如何在没有类或功能组件的情况下使用redux道具?

Reactjs 如何在没有类或功能组件的情况下使用redux道具?,reactjs,react-redux,Reactjs,React Redux,我有一个constants.js文件,如下所示: import { connect } from 'react-redux'; const ConstantFiles = { { text: "CLEAR FILTERS", style: { color: "#fff",

我有一个
constants.js
文件,如下所示:

import { connect } from 'react-redux';

const ConstantFiles = {

    {
                            text: "CLEAR FILTERS",
                            style: {
                                color: "#fff",
                                backgroundColor: "#070d59",
                                cursor: "pointer",
                                padding: "2%",
                            },
                            clicked: () => {
                                //I need to put the redux function here
                            }
                        },

};

const mapDispatchToProps = dispatch => {
    return {
        
        onMetricConditionAdd: () => dispatch(actions.clearAllFilters()),
    }
  
  }



export default connect(null,mapDispatchToProps)(ComponentDetails);

我想在MetricConditionAdd上执行
,但既然它是一个常量文件,那么访问它的正确方法是什么?因为它不是一个类组件,所以我不能使用
这个。props
或者仅仅
props

您需要创建一个React组件,并将其包装在
connect
HOC中,因此
onMetricConditionAdd
被作为一个道具注入。
ConstantFiles
在哪里使用/消费?