Redux Form - How to Fill Initial Values ​​in FormSection Components

I followed this redux-form docs tip where it indicates that it is beneficial to make a basic form consisting of many components using "FormSection".

Having done this, I have a client form with the Address component built in as follows:

      <FormSection name="Address">
           <Address />
      </FormSection>

He works.

However, when I want to set the initial values ​​of the main form from the state according to this example in redux docs forms the main form is filled, but the Address component in FormSection does not work.

I used this code at the bottom of the client component to connect to the state:

  let ClientForm2 = connect(
    (state, ownProps) => ({
      initialValues: state.editClient, 
      enableReinitialize: true
    }),
        { reducer }
  )(ClientForm);

How do you populate FormSections with initial values ​​from the state that comes from the main form?

, intial...

+4
1

, . initialValues ​​ ?

{
 field1: 'a default value', 
 field2: 'somevalue2',
 Address: { formSectionFieldName1: 'test value', } 
}

FormSection.name . , 'address.formSectionFieldName2': 'test value'

0

Source: https://habr.com/ru/post/1684858/


All Articles