score:1

Accepted answer

well, the problem was using a bad form reducer, probably taken from an outdated example:

import { reducer as formreducer } from 'redux-form/immutable';

its a stupid mistake but i expect a descent error message. ofcourse the right usage is:

import { reducer as reduxformreducer } from 'redux-form';

score:0

nothing is being rendered, probably, because you have no employees and you don't render the renderemployees component when the employee list is empty.

if you want to have at least 1 employee, in such a way that it will render an empty item, you can pass initialvalues to the form, passing the array with an empty item.

this is a modified version of the fieldsarray example you provided, in which there's 1 initial member.

const initialvalues = {
  "members": [
    {
      "firstname": "",
      "lastname": "",
      "hobbies": []
    }
  ]
}

reactdom.render(
  <provider store={store}>
    <div style={{ padding: 15 }}>
      <h2>field arrays</h2>
      <fieldarraysform onsubmit={showresults} initialvalues={initialvalues} />
      <values form="fieldarrays" />
    </div>
  </provider>,
  rootel,
);

example in codesandbox:

https://codesandbox.io/s/dkwkr6kr5


Related Query

More Query from same tag