Disable Empty Region Field
When the user hasn't selected a country, nothing's going to show up in the Region dropdown. If you want to disable it,
use the disableWhenEmpty
prop.
import React, { useState } from 'react';
import { CountryDropdown, RegionDropdown } from 'react-country-region-selector';
const NoDefaultOption = () => {
const [country, setCountry] = useState('');
const [region, setRegion] = useState('');
return (
<>
<CountryDropdown value={country} onChange={(val) => setCountry(val)} />
<RegionDropdown
country={country}
value={region}
onChange={(val) => setRegion(val)}
disableWhenEmpty={true}
/>
</>
);
};
export default NoDefaultOption;