I want to get unique data from db in the drop-down menu as i have two drop-down menus and both are depended on each other for example if i select something in one drop-down then it will show so data related to that in the other drop-down. `
<FormDataConsumer>
{({ formData, dispatch, ...rest }) => (
<Fragment>
<ReferenceInput basePath={props.basePath} validate={requiredValidator} source="cc_documents_section_id" reference="documents-section" label="Document Type">
<SelectInput optionText="cc_document_type" {...rest} />
</ReferenceInput>
<ReferenceInput source="cc_documents_section_id" reference="documents-section" validate={requiredValidator} label="Document Name">
<SelectInput optionText="cc_document_name"
onChange={value => dispatch(
change(REDUX_FORM_NAME,'cc_document_type', null)
)}{...rest}
/>
</ReferenceInput>
</Fragment>
)}
</FormDataConsumer>`
In db there are fields like this
{ doctype: "A", docname: "X", id: 1 },
{ doctype: "A", docname: "Y", id: 2 },
{ doctype: "B", docname: "Z", id: 3 }
in first drop-down i want to show unique data from doctype and in second it will show docname accordingly