New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-countries

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-countries

A tiny fully customizable react hook which gives you full list of countries with their name, dial code, alpha-2 code and flag emoji.

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

react-countries

A tiny fully customizable react hook which gives you full list of countries with their name, dial code, alpha-2 code and flag emoji.

NPM JavaScript Style Guide

Install

  • npm
npm install --save react-countries
  • yarn
yarn add react-countries

Usage

A simple example of a component which you can copy-paste and take info about all countries.

import { useCountries } from 'react-countries'

const App = () => {
  const { countries } = useCountries()

  return (
    <>
      <ul>
        {countries.map(
          ({
            name,
            dial_code,
            code,
            flag
          }) => (
            <li key={name}>{flag + " " + name + " | " + code + " (" + dial_code + ")"}</li>
          )
        )}
      </ul>
    </>
  );
}

API

  • Country interface
type country = {
  name: string,
  flag: string,
  code: string,
  dial_code: string,
}
PropertyTypeDescription
namestring
flagstring
codestring
dial_codestring

Authors

License

MIT © hirenkvaghasiya

Keywords

country

FAQs

Package last updated on 20 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts