Tutorial
In this tutorial you'll learn how to use React country region flag selector, Follow the tutorial below to learn how to use React country region flag selector. Installation
npm i react-country-region-select
yarn add react-country-region-select
Basic Usage
This library offers a set of React elements that allow for displaying interlinked dropdown menus for countries(with flag/without flag) and regions (select a country, and it displays the corresponding regions)import React, { Component } from 'react';
import { RegionSelector, CountrySelector } from 'react-country-region-select';
const App = () => {
const [country, setCountry] = useState('');
const [region, setRegion] = useState('');
return (
<><CountrySelector
showCountryFlag
label="Select Country"
value={country}
onChange={setCountry} />
<RegionSelector
label="Select Region"
country={country}
value={region}
onChange={setRegion} /></>
)
}
export default App