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.97k stars 1.27k forks source link

How to access state of certain country? #526

Open devrudraa opened 5 months ago

devrudraa commented 5 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: