How to use the react-country-region-selector.CountryRegionData.findIndex function in react-country-region-selector

To help you get started, we’ve selected a few react-country-region-selector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lianetoolkit / liane-toolkit / imports / ui2 / components / RegionSelect.jsx View on Github external
_getOptions = () => {
    const { country } = this.props;
    const countryIdx = CountryRegionData.findIndex(
      c => c[0] == country || c[1] == country
    );
    let options = [];
    if (countryIdx) {
      const regions = CountryRegionData[countryIdx][2].split("|");
      options = regions.map(region => {
        const splitted = region.split("~");
        return {
          value: splitted[1],
          label: splitted[0]
        };
      });
    }
    return options;
  };
  _getValue = () => {

react-country-region-selector

Country/region React components for your forms.

MIT
Latest version published 13 days ago

Package Health Score

80 / 100
Full package analysis

Similar packages