Package Exports
- react-use-country-region
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-use-country-region) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-use-country-region
A simple react hook to display a country regions. Use with any UI Framework (Material UI) or any Headless UI (React Aria, Reach UI, etc) Uses country-region-data package dependencies to provide (latest) data.
Install
yarn add react-use-country-regionUsage
Get list of countries
To get list of available countries
import { useCountryRegion } from 'react-use-country-region';
const Example = () => {
const { getCountryList } = useCountryRegion();
const data = getCountryList();
return <div>{JSON.stringify(data)}</div>;
};Get list of regions
Simply pass a valid ISO country code to get regions/state/provice data
import { useCountryRegion } from 'react-use-country-region';
const Example = () => {
const { result } = useCountryRegion('MY');
return <div>{JSON.stringify(result.regions)}</div>;
};License
MIT © MistaPidaus