mledoze / countries

World countries in JSON, CSV, XML and Yaml. Any help is welcome!
https://mledoze.github.io/countries/
Open Data Commons Open Database License v1.0
5.99k stars 1.27k forks source link

How to access state of certain country? #526

Open devrudraa opened 7 months ago

devrudraa commented 7 months ago

I am trying to make an address form where users can select the country and based on the selection they can select the state and city but I didn't find any way to access the state or city of a particular country.

      <Select
        fullWidth
        value={selectedCountry}
        onChange={handleCountryChange}
        label="Country"
      >
            {countries.map((country) => {
              return (
                country && (
                  <MenuItem key={country.flag} value={country.flag}>
                    {country.name.common}
                  </MenuItem>
                )
              );
            })}
   </Select>

I want to get all the states based on the 'selectedCountry' value

Stack:

mledoze commented 1 week ago

I didn't find any way to access the state or city of a particular country

What do you mean? The dataset does not contains the cities of a country.