我可以将 redux-form [v6] 连接到其他状态,例如 [v5] 吗?

Can i connect redux-form [v6] to other state, like in [v5]?

我可以在 redux-form v6.

中配置 mapStateToProps 和其他 react-redux 参数吗

redux-form 中像这样 v5 ~> http://i.stack.imgur.com/nSZKM.jpg

reduxForm(config:Object, mapStateToProps?, mapDispatchToProps?, mergeProps?, options?)

Creates a decorator with which you use redux-form to connect your form component to Redux. It takes a config parameter and then optionally mapStateToProps, mapDispatchToProps, mergeProps and options parameters which correspond exactly to the parameters taken by react-redux's connect() function, allowing you to connect your form component to other state in Redux.

.

例如:

import { reduxForm } from 'redux-form/immutable';

...

export default reduxForm({
  form: 'signUp'
}, state => ({
  lists: state.get('list').toJS()
}));

是的,您可以在版本 6 中将您的 redux 状态连接到您的 redux-form 组件。这是一个示例(您现在必须手动装饰连接)。

import { connect } from 'react-redux';
import { reduxForm } from 'redux-form';
import {
    actionCreatorOne,
    actionCreatorTwo
} from './actionCreators';

class MyForm...

function mapStateToProps(state) {
    return {
        name: state.user.name
    };
}

let mapDispatch = {
    actionCreatorOne,
    actionCreatorTwo
};

MyForm = reduxForm({
    form: 'myForm'
})(MyForm);

export default MyForm = connect(mapStateToProps, mapDispatch)(MyForm);