Shortcode Values
The valueType
prop on both components alters the value of each option to be a short code rather than the full
country or region name, like with the visible label. Note that when you use valueType
as short
for the
CountryDropdown
component you need to tell the RegionDropdown component that it's using shortcodes via the
countryValueType
prop.
import React, { useState } from 'react';
import { CountryDropdown, RegionDropdown } from 'react-country-region-selector';
const ShortcodeValues = () => {
const [country, setCountry] = useState('');
const [region, setRegion] = useState('');
return (
<>
<CountryDropdown
value={country}
onChange={(val) => setCountry(val)}
valueType="short"
/>
<RegionDropdown
country={country}
value={region}
valueType="short"
countryValueType="short"
onChange={(val) => setRegion(val)}
/>
</>
);
};
export default ShortcodeValues;