Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oktaysenkan/use-countries
Custom react hook to list countries and languages.
https://github.com/oktaysenkan/use-countries
countries hook javascript languages react
Last synced: about 1 month ago
JSON representation
Custom react hook to list countries and languages.
- Host: GitHub
- URL: https://github.com/oktaysenkan/use-countries
- Owner: oktaysenkan
- License: mit
- Created: 2020-03-14T16:21:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-03-14T17:22:06.000Z (over 4 years ago)
- Last Synced: 2024-09-19T12:38:12.832Z (3 months ago)
- Topics: countries, hook, javascript, languages, react
- Language: TypeScript
- Homepage:
- Size: 60.5 KB
- Stars: 25
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-react-hooks - `use-countries`
- awesome-react-hooks-cn - `use-countries`
- awesome-react-hooks - `use-countries`
- awesome-react-hooks - `use-countries`
README
# useCountries
You can list `countries` and `languages`
## Installing
```
npm i use-countries --save
``````
yarn add use-countries
```## Usage
```jsx
import useCountries from "use-countries";
const {
countries,
languages,
country,
setCountry,
language,
setLanguage
} = useCountries();
``````js
{countries.map(item => (
{item.name}
))}```
### Country
```json
{
"code": "AD",
"name": "Andorra",
"native": "Andorra",
"phone": "376",
"continent": "EU",
"capital": "Andorra la Vella",
"currency": "EUR",
"languages": ["ca"],
"emoji": "🇦🇩",
"emojiU": "U+1F1E6 U+1F1E9"
}
```### Language
```json
{ "code": "AA", "name": "Afar", "native": "Afar" }
```