Here - http://redux-form.com/6.5.0/examples/selectingFormValues/ is an example of working with formValueSelector , it works great. As you can see, the name of the form is explicitly indicated in the example.

  const selector = formValueSelector('selectingFormValues') // <-- same as form name 

But what if the form identifier is given by me through props , for there may be several forms on the page + the same component is used both for creating and editing the model.

 let MyForm = (props) => { return( <Form form={props.form || 'default_name'}> .......... </Form> ) } MyForm = reduxForm({ fields:[.........], validate })(MyForm) const selector = formValueSelector(??) // Как мне достать идентификатор формы? ................. 
  • Redux-form creates a separate state for redux in each form. If the parent component is connected to redux, you can get the form id from there: this.props.form. <FormName> - arnage
  • You probably did not understand the question. The parent component, in this case, the MyForm component passes the props form, i.e. a function (in my case it is a function) MyForm is passed an object in which there is a form property, and inside this function I “know everything”. The selector is also used OUT functions, and there is no access to the props . I have already decided the question and wrote it off as an answer .. Ie I decided not to use formSelector to access the values ​​.. and immediately, the container passes the form.<formName>.values - form.<formName>.values

1 answer 1

In general, nothing more elegant, I have not figured out how to remove the formValueSelector and transfer form values ​​from the container to the props.

I will be glad to know other solutions.