I am using react-admin SelectInput and uses name as options but there are in the list that has the same name so the option shows duplicate values. I have tried doing research about filtering duplicate values but I can't seem to make it work.
My data looks like this:
data: [{name: "car1",id: 1,}, {name: "car1",id: 2,}, {name: "car2",id: 3,}]
Select options will display: car1, car 1, car 2 I want to display no duplicate: car1, car2
Here is my code:
<SelectInput optionText={<Choice/>}/>
const Choice = ({...record}) => {
return(
<span>{`${record && record.record.carName}`}</span>
)
}
It allows me to play with the select options below like this and it display "test" so I think it can be done here but I cant find a good logic to implement the filter. Anyone has any idea? I'd greatly appreciate it!
`${record && record.record.carName}` !== 'car1' ? <span>test</span> : null
<SelectInput />. Instead of filtering it within the choice itself.