Home > Net >  Ant Design React how can I filter Dropdown between two Selects
Ant Design React how can I filter Dropdown between two Selects

Time:05-29

countries: [
  {
    label: "Italy",
    value: "Italy"
  },
  {
    label: "France",
    value: "France"
  },
  {
    label: "Belgium",
    value: "Belgium"
  },
  {
    label: "United Kingdom",
    value: "United Kingdom"
  }
];

CodePudding user response:

Please go through if this example helps you. If not could you provide more information about what are you looking for and the code what have you tried so far.

CodePudding user response:

const [countryList, setCountryList] = useState([])
      const handleChange = (value) => {
        setCountryList(value)
      }
      <Select
        onChange={handleChange}
        mode="multiple"
      >
        {countries.map((country) => (
          <Option key={country.key}>{country.value}</Option>
        ))}
      </Select>

if u are able to get the list in the country list then you can filter it like below

countryList.filter((c) => 'filter condition here' )

  • Related