I am using redux-form with an FieldArray and I'm trying to create different renderings depending on which button is clicked on.
assuming I have the following function (which is in the component attribut of a FieldArray in a form):
const renderCatalogCategories = (props) => {
const { fields } = props;
return (
<div>
{fields.map((data, idx) =>
<Panel key={idx} header={`${data}.type`} data={data} />
)}
<DropdownButton>
<MenuItem onClick={() => fields.push({type: 'a'})}>a</MenuItem>
<MenuItem onClick={() => fields.push({type: 'b'})}>b</MenuItem>
</DropdownButton>
</div>)
};
It is not possible to get the value of type which I pass in the fields.push on the MenuItems. You have an idea how I can get this value?
The value of data I get is just a string, e.g. categories[9]