prop类型失败:提供给Form(xxx)的对象类型无效的prop形式,预期为字符串

时间:2018-11-14 15:59:28

标签: reactjs redux-form react-proptypes

我正在构建Redux表单,但似乎无法解决以下错误。我正在使用redux-form v7.4.x

这是我目前在班级部分中所拥有的:

//Decorate with connect to read form values
const selector = formValueSelector('selectingFormValues') // <-- same as form name
//const mapStateToProps = state => state.form['object Object'];

const mapStateToProps = state => {
//  const services: state.services;
    const formState = getFormValues('IAMSubnetFormNew')(state);
    if(formState == undefined){
        return state;
    }
    return formState
}


function mapDispatchToProps(dispatch) {
    return bindActionCreators(
        {
            fetchIAMConfig, fetchIAMConfigCount, change
            , fetchIAMRanges, fetchIAMRangesCount
            ,requestSubnet, fetchIAMInc, fetchNetworkTopology
            ,fetchSubnetClass
            ,createCramerspooler
        },
        dispatch
    );
}


const IAMSubnetFormP = reduxForm({
    form: 'IAMSubnetFormNew', // a unique name for this form
    fields: [
        'type_of_subnet_id','subnet_type','location', 'security_zone', 'seczone', 'routing_domain','zone_confirm', 
        'subnet_size', 'subnet_confirm','iam_addressing_type_id', 'address_space', 'allocation_range', 'new_subnet',
        'desc_vr','desc_vr_confirm',
        'l2env', 'l2env_confirm',
        'l3dev', 'l3dev_confirm',
        'zone_platform',
        'wo', 'iam_network_diagram_id','subnet_class',
        'project', 'justification','project_confirm'
        ]
})(IAMSubnetForm)

const typeOfSubnetId = formValues('type_of_subnet_id')(IAMSubnetFormP)

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

/*
export default reduxForm({
    form: 'IAMSubnetFormNew' // a unique name for this form
})(
    connect(mapStateToProps, mapDispatchToProps)(IAMSubnetForm)
);
*/

我尝试过在代码上注释掉的其他选项,但仍然会引发相同的错误。

https://codesandbox.io/s/24x376j98n

0 个答案:

没有答案