Skip to content

RomanBON/react-geoidentify-country-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Support me with a Follow

react-geoidentify-country-selector

The best country selector on react with Identifier geocoder of current position.

This component support the display 3 standard:

  • ISO Alpha-2: "ISOALPHA2Code": "GE"
  • ISO Alpha-3: "ISOALPHA3Code": "GEO"
  • ISO Numeric Country Codes: "ISONumericalCode": 268

See Demo

Installation

$ npm i react-geoidentify-country-selector --save

or

$ yarn add react-geoidentify-country-selector

Basic Usage

ES6 with JSX example

import React from 'react';
import CountrySelector from 'react-geoidentify-country-selector';

class App extends React.Component {
    getSelectedCountry(coutryObject) {
        console.log(coutryObject);
        /*
            {
                countryName: "Georgia",
                ISOALPHA2Code: "GE",
                ISOALPHA3Code: "GEO",
                ISONumericalCode: 268
            }
        */
    }
    render() {
        return (
            <div>
                <CountrySelector
                    defaultCountry="Georgia" // First priority
                    // defaultISOALPHA2Code="KZ" // Second priority
                    // defaultISOALPHA3Code="KEN" // Third priority
                    // defaultISONumericalCode={410} // Fourth priority
                    getSelectedCountry={coutryObject => this.getSelectedCountry(coutryObject)}
                />
            </div>
        );
    }
}

export default App;

##See Also

Licence

MIT